home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / wasm201.arc / WASM.DOC < prev   
Text File  |  1988-07-17  |  196KB  |  4,738 lines

  1.  
  2.        
  3.        
  4.        
  5.        
  6.        
  7.        
  8.        
  9.        
  10.        
  11.        
  12.        
  13.        
  14.        
  15.                                   \\\ WASM ///
  16.        
  17.                                Wolfware Assembler
  18.                                   Version 2.01
  19.        
  20.                                   User's Manual
  21.        
  22.        
  23.                         (C) Copyright 1987 by Eric Tauck
  24.        
  25.                                 Wolfware Programs
  26.        
  27.  
  28.                                 Table of Contents
  29.        
  30.              Introduction ....................................... 1
  31.              Distribution Policy ................................ 3
  32.              Assembling Programs ................................ 4
  33.              Basic Syntax ....................................... 6
  34.                Symbols .......................................... 8
  35.                Instructions ..................................... 9
  36.                Operands ........................................ 10
  37.                Operand Expressions ............................. 14
  38.              Program Structure ................................. 16
  39.              Procedures ........................................ 17
  40.              Conditional Assembly .............................. 18
  41.                Conditional Directives .......................... 19
  42.                Nested Conditional Assembly ..................... 22
  43.                Conditional Operators ........................... 24
  44.                Conditional Operand Testing ..................... 25
  45.              Macros ............................................ 27
  46.                Defining Macros ................................. 28
  47.                Invoking Macros ................................. 30
  48.                Nested Macros ................................... 32
  49.                Conditional Macros .............................. 33
  50.                Listing of Macros ............................... 34
  51.              Data .............................................. 35
  52.              Assembly Directives ............................... 37
  53.              Functional Operands ............................... 55
  54.              Assembly Constants ................................ 61
  55.              Reserved Symbols .................................. 64
  56.              Assembly Listing .................................. 65
  57.              Symbol Table Listing .............................. 67
  58.              Assembly Messages ................................. 68
  59.              Instruction Set ................................... 79
  60.              External Subroutines .............................. 91
  61.              Source Code Clarification ......................... 92
  62.              Memory Limitations ................................ 96
  63.              Bibliography ...................................... 97
  64.              Index ............................................. 98
  65.  
  66.        Introduction                                                     1
  67.        
  68.                                   Introduction
  69.        
  70.        Wolfware Assembler (WASM) is an assembly language compiler for the
  71.        IBM PC and compatibles.  It takes a standard ASCII text file of
  72.        8086 instruction mnemonics for input and produces an executable
  73.        COM file and an optional list file for output.
  74.        
  75.        - Minimum system requirements: 8086 based or machine language
  76.          compatible computer, MS/PC DOS 2.00 or up, and about 100
  77.          kilobytes of free memory.
  78.        
  79.        - Features: supports full range of 8086 instructions and
  80.          addressing, most standard assembly directives, signed and
  81.          unsigned numbers, operand expressions, conditional assembly,
  82.          macros, produces executable code (does not require linking), and
  83.          fairly fast operation.
  84.        
  85.        Assembly language is a programming language in which the source
  86.        statements are translated directly into individual microprocessor
  87.        instructions.  This direct translation allows complete control
  88.        over the computer and the greatest possible optimization of a
  89.        program.  Programming in assembly language has immediate and
  90.        practical benefits:
  91.        
  92.        - Programs can be made to run hundreds, maybe thousands of times
  93.          faster than their high level language counterparts.
  94.        
  95.        - Programs are usually much smaller and more efficient.
  96.        
  97.        - Programs can take full advantage of the system it is meant to
  98.          run on.
  99.        
  100.        Assembly language is essential where speed, compactness, and low
  101.        level or hardware control are the primary requirements.  WASM is
  102.        best suited for writing smaller, stand-alone programs and
  103.        optimized routines that are used by other programs.  WASM is ideal
  104.        for writing machine language subroutines for BASIC or Turbo
  105.        Pascal.
  106.        
  107.        The disadvantage of assembly language is that the writing and
  108.        debugging of such programs are often more difficult.  Another
  109.        consideration is that assembly language is not very portable, i.e.
  110.        programs written in assembly language are usually restricted to
  111.        one type of computer.
  112.        
  113.        WASM is easier to use than most commercial assemblers because of
  114.        its simplified syntax and program structure.  Of course, by the
  115.        same token, WASM is not necessarily compatible with other
  116.        assemblers.
  117.        
  118.  
  119.        2                                                     Introduction
  120.        
  121.        Though this documentation explains some of the basic concepts of
  122.        assembly language, no attempt is made to to teach it.  The user
  123.        should be familiar with the basic concepts of programming and have
  124.        a general knowledge of the the 8086 microprocessor.  See the
  125.        bibliography for some possible reference materials.
  126.        
  127.  
  128.        Distribution Policy                                              3
  129.        
  130.                                Distribution Policy
  131.        
  132.        You are encouraged to freely share and distribute unmodified
  133.        copies of this program and documentation.  A nominal fee may be
  134.        charged to cover the costs of duplication and distribution.
  135.        
  136.        If you find this program useful, you are expected to help support
  137.        its development by registering your copy.  To register, send $10
  138.        to:
  139.        
  140.          Eric Tauck
  141.          Wolfware Programs
  142.          1304 Deerpass Road
  143.          Marengo, IL  60152
  144.        
  145.        You can use the registration form in the file REGFORM.DOC for this
  146.        purpose.  Please make checks payable to Eric Tauck.
  147.        
  148.        Registration entitles you to one year of support, which includes:
  149.        
  150.          1) Notification of any significant new versions of WASM.
  151.          2) The option to upgrade at any time for $5.
  152.        
  153.        The terms and prices of registration will be effective at least
  154.        through 1987.  Whether you register or not, feel free to comment
  155.        about the program or documentation.  In addition to the address
  156.        above, I can also be reached electronically at:
  157.        
  158.          BIX ........... etauck
  159.          CompuServe .... 72457,1557
  160.          GEnie ......... e.tauck
  161.          People/Link ... ofr215
  162.        
  163.        I usually check for electronic mail twice a week.
  164.        
  165.  
  166.        4                                              Assembling Programs
  167.        
  168.                                Assembling Programs
  169.        
  170.        Programs are assembled by running the assembler and specifying the
  171.        names of the source, object, and list files.  To run the assembler
  172.        from any DOS prompt, you type "WASM" and then a carriage return.
  173.        A brief opening message will be displayed and you will be prompted
  174.        for all the required information.  Default file names will be
  175.        provided if no name is otherwise specified.  The default name
  176.        appears in brackets at the end of the prompt line.  An entire file
  177.        name consists of a path, filename, and extension.  The drive
  178.        specification is considered part of the path.
  179.        
  180.        The source file contains the list of instructions that are to be
  181.        assembled into machine code.  It must be a standard ASCII text
  182.        file created by the user before assembly.  If you enter a source
  183.        file name without an extension, the default extension of ASM will
  184.        be automatically added to it.  ASM is the standard filename
  185.        extension for assembler source files.
  186.        
  187.        The object file contains the machine code result of the assembly.
  188.        The object file will be created if it doesn't already exist; if
  189.        does exist the original file will be overwritten.  The default
  190.        name is the source path and filename with an extension COM.  You
  191.        may enter any component(s) of the name which you want to be
  192.        different from the default name (like only the path and extension
  193.        for instance).  COM is reserved by DOS as the filename extension
  194.        for executable "command" files.  The object file is not a linkable
  195.        object file, but a binary image of the compilation.  The object
  196.        file, assuming the source code was logically correct and that
  197.        there were no errors during assembly, is directly executable from
  198.        DOS.  If you use the extension COM, you can run the assembled
  199.        program just by typing its filename.
  200.        
  201.        The list file contains the listing of the assembly.  The list file
  202.        will be created if it doesn't already exist; if does exist the
  203.        original file will be overwritten.  If no list file is specified,
  204.        no listing will be produced. If you do enter a filename, the
  205.        object path and an extension of LST will be used as the default.
  206.        Specifying CON as the list file will send the listing to the
  207.        screen, and specifying PRN as the list file will send the listing
  208.        to the printer.  The listing itself is more thoroughly described
  209.        under Assembly Listing.
  210.        
  211.        The names of the three files may be entered on the command line
  212.        when WASM is initially executed.  To do this you must provide at
  213.        least the name of the source file.  The other two names are
  214.        optional.  All names should be separated from each other by a
  215.        comma.  You can use a default name by placing a comma without a
  216.        name, or by just leaving the name off the end.  The normal
  217.        defaults to all names still apply.  WASM will display the names of
  218.        the three files taken from the command line.
  219.        
  220.  
  221.        Assembling Programs                                              5
  222.        
  223.        Examples of command line file specifications:
  224.        
  225.          WASM TEST
  226.            source is TEST.ASM, object is TEST.COM, and there is no list
  227.        
  228.          WASM ABC, , ABC
  229.            source is ABC.ASM, object is ABC.COM, and list is ABC.LST
  230.        
  231.          WASM  SUBRT, .BLD
  232.            source is SUBRT.ASM, object is SUBRT.BLD, and there is no list
  233.        
  234.          WASM TEST.TXT, STUPID.BIN, HELLO.DOC
  235.            source is TEST.TXT, object is STUPID.BIN, and list is
  236.            HELLO.DOC
  237.        
  238.          WASM A:\ASSM\PROG1,,B:PROG1
  239.            source is A:\ASSM\PROG1.ASM, object is A:\ASSM\PROG1.COM, and
  240.            the list is B:PROG1.LST
  241.        
  242.          WASM GAME.SRC, C:\GAMES\.COD, C:\LISTS\GAME
  243.            source is GAME.SRC, object is C:\GAMES\GAME.COD, and the list
  244.            is C:\LISTS\GAME.LST
  245.        
  246.        If there are errors detected during assembly, they will be
  247.        displayed in the listing.  If there is no listing being generated,
  248.        the errors will be displayed to the screen along with the line
  249.        causing the error.  Any errors should be corrected and the program
  250.        reassembled before running or debugging the program.
  251.        
  252.        At the end of assembly several statistics are displayed: the
  253.        number of errors, the number of lines assembled, the number of
  254.        bytes of code, and the number of symbols defined.  These
  255.        statistics are sent to the list file if a listing is being
  256.        generated, otherwise they will be displayed to the screen.  A
  257.        message stating if any errors where detected will shown if the
  258.        assembly statistics were not displayed to the screen.
  259.        
  260.        An error code is returned upon termination.  This error code can
  261.        be acted upon in a batch file with ERRORLEVEL (see your DOS manual
  262.        for details).  The error codes are as follows:
  263.        
  264.         Code  Meaning
  265.         ----  -------
  266.          0    no lines flagged
  267.          1    lines were flagged for comment but no errors were detected
  268.          2    errors were detected but the assembly was completed
  269.          3    the assembly was prematurely terminated due to errors
  270.          4    assembly could not begin (incorrect DOS or not enough mem.)
  271.        
  272.  
  273.        6                                                     Basic Syntax
  274.        
  275.                                   Basic Syntax
  276.        
  277.        The source file must be a standard ASCII text file.  The only
  278.        control characters given special treatment are line boundaries
  279.        (ASCII codes 13 and 10) and end of file markers (ASCII code 26).
  280.        All other control characters are treated as spaces.  The source
  281.        lines may be up to 160 characters long.  If the source file does
  282.        not have an end of file marker, the assembler will read the number
  283.        of bytes recorded in the directory. The line editor EDLIN.COM
  284.        provided with DOS is suitable for creating source files.
  285.        
  286.        All 8086 instructions perform an operation on zero, one, or two
  287.        operands.  Assembly directives (commands to control the assembler
  288.        itself) are implemented in a similar manner.  Generally each line
  289.        will contain a single 8086 instruction, or directive, and its
  290.        operands.  In addition to instructions and their operands, a line
  291.        may contain a symbol declaration.
  292.        
  293.        The source file is assembled line by line.  Each line is divided
  294.        up into fields separated by delimiters.  Delimiters consist of
  295.        spaces and most control characters.  How the assembler tries to
  296.        interpret each field is based on the location of the field within
  297.        the line.  Lines are interpreted according to the following
  298.        format:
  299.        
  300.                      Symbol    Instruction  Operands    ;Comment
  301.        
  302.        Symbols must begin on the first character of the line.  If the
  303.        first character of a line is a delimiter, the line is assumed not
  304.        to contain a symbol declaration.  Symbols are only required when
  305.        the instruction is one that specifically defines some sort of
  306.        symbol (like an equate or macro declaration).  Symbols may be any
  307.        length as long as they fit on the line.  Symbols may consist of
  308.        most characters as long as they are unique from each other and all
  309.        predefined symbols.  The rule of thumb is to start symbols with a
  310.        letter and make the rest of the symbol out of numbers, letters,
  311.        and underscores.  Restrictions on symbol declarations are more
  312.        thoroughly described under Reserved Symbols.  Symbols in general
  313.        are described under Symbols.
  314.        
  315.        Instructions must be separated by at least one delimiter from the
  316.        symbol.  If there is no symbol, at least one delimiter must
  317.        precede the instruction (so it doesn't start on the first
  318.        character of the line).  All instructions are predefined.  See
  319.        Instructions.
  320.        
  321.        Operands must be separated by at least one delimiter from the
  322.        instruction.  Since a single operand may consist of multiple
  323.        fields, operands must be separated from each other by commas.  The
  324.        instruction determines how many of what kind of operands are
  325.        required.  See Operands.
  326.        
  327.  
  328.        Basic Syntax                                                     7
  329.        
  330.        Comments come at the end of the line after a semi-colon.  Comments
  331.        may consist of anything and be any length as long as they fit on
  332.        the line.  Comments are always optional and are only there to
  333.        assist the programmer in understanding the source code.
  334.        
  335.        Blank lines may be placed in the source code to improve
  336.        readability.  Blank lines are ignored by the assembler.  Lines may
  337.        also contain only a comment, in which case they are treated as
  338.        blank lines.
  339.        
  340.  
  341.        8                                                          Symbols
  342.        
  343.                                      Symbols
  344.        
  345.        Symbols are used to identify certain aspects of the source
  346.        program.  Symbols allow those aspects to be referenced
  347.        symbolically.  The effective use of symbols can make a program
  348.        easier to understand.  Symbols can also simplify the modification
  349.        of a program.  By changing the portion of the program represented
  350.        by the symbol, you automatically change the program at every
  351.        location the symbol is used.
  352.        
  353.        A symbol is created by declaring it.  This is done by placing the
  354.        symbol field on the first column of a source line.  A line may
  355.        contain only a symbol, or only a symbol and a comment.  Declaring
  356.        a symbol causes the assembler to internally store it in the symbol
  357.        table.  An ambiguity arises if a particular field is defined more
  358.        than once as a symbol, since if that symbol is used, the assembler
  359.        will not be able to tell which definition is actually being
  360.        accessed.  For this reason, all symbols must be unique from each
  361.        other.  In addition to being unique from each other, programmer
  362.        defined symbols must be unique from all predefined symbols.
  363.        Restrictions on symbol declarations are more thoroughly described
  364.        under Reserved Symbols.
  365.        
  366.        Symbols come in several different types, the most common of which
  367.        is the label.  Labels identify a location in memory.  Labels are
  368.        used for two purposes, branching and data access.  Labels for
  369.        branching are called near labels.  Labels for data access are
  370.        called memory labels.  Memory labels come in different sizes
  371.        according to how many bits of memory are referenced.  The other
  372.        symbol types are equates and macros.  Equates represent a single
  373.        number.  Macros represent an entire series of instructions.
  374.        
  375.        The symbol type is determined by the instruction.  The declaration
  376.        directives (DB, DW, and DS) create memory labels, the EQU
  377.        directive creates an equate, the MACRO directive creates a macro,
  378.        and the LABEL directive creates a label of a specified type.  Most
  379.        other instructions, and symbols on lines without instructions,
  380.        result in near labels.
  381.        
  382.        Symbols are used by the program in two different ways, as
  383.        instructions and as operands.  Only macros are used as
  384.        instructions.  The remaining symbol types are used as operands.  A
  385.        symbol does not have to be declared before it is used, i.e. memory
  386.        references, equates, and macros may be declared anywhere in the
  387.        program.  Near labels should be placed at the location where the
  388.        code execution should continue after the branch.
  389.        
  390.  
  391.        Instructions                                                     9
  392.        
  393.                                   Instructions
  394.        
  395.        An 8086 instruction specifies the action that should be carried
  396.        out on the operands by the microprocessor.  Assembly directives
  397.        are special instructions to control the assembly itself.  8086
  398.        instructions and directives are implemented in the same manner,
  399.        there is no syntactic difference between the two.
  400.        
  401.        Over a hundred different instructions are recognized by the 8086
  402.        microprocessor.  The two major types of instructions are those
  403.        that manipulate bits in memory and those that transfer control
  404.        from one location in the program to another.  A summary of all the
  405.        legal instructions can be found under Instruction Set. For a full
  406.        explanation of all 8086 instructions, you should acquire a book on
  407.        the subject.
  408.        
  409.        There are assembly directives for many different purposes.
  410.        Specific assembly directives are described in their relevant
  411.        sections and under Assembly Directives.
  412.        
  413.  
  414.        10                                                        Operands
  415.        
  416.                                     Operands
  417.        
  418.        The operands describe what is being acted upon by the instruction.
  419.        There are many different types of operands.  The number and type
  420.        of operands required is determined by the particular instruction.
  421.        The operands needed for an instruction can be looked up under
  422.        Instruction Set.  WASM figures out the type of an operand by
  423.        looking at it and trying to match it to one of the formats it
  424.        recognizes.  If the operand is not recognized as a standard
  425.        predefined type, the symbol table is searched to see if has been
  426.        defined by the programmer.
  427.        
  428.        The following is a list of the legal operand types and their
  429.        formats:
  430.        
  431.          I. Immediate data operands.
  432.        
  433.             A. Numbers with an optional plus or minus preceding it.  All
  434.                numbers must begin with a 0 to 9, and anything that begins
  435.                as such is considered a number.  Numbers with a sign must
  436.                be in the range -32768 to +32767, otherwise they must be 0
  437.                to 65535
  438.        
  439.                1. A binary number of up to 16 digits of ones and zeros
  440.                   followed by a "B".
  441.        
  442.                2. A decimal number from 0 to 65535.
  443.        
  444.                3. A hexadecimal number of up to 4 digits of 0 to F
  445.                   followed by an "H".  Hexadecimal numbers that begin
  446.                   with A to F should have a preceding 0.
  447.        
  448.             B. A character enclosed in single quotes.  The character is
  449.                converted to an 8 bit ASCII value, so 'z' would be the
  450.                same as the number 122.
  451.        
  452.             C. A pair of characters enclosed in single quotes.  The
  453.                characters are converted to a 16 bit value calculated from
  454.                their ASCII values.  If 'ab' where moved into a register,
  455.                the high byte would receive the value of 'b' and the low
  456.                byte would receive the value of 'a'.  'ab' is the same as
  457.                the number (98*256)+97 = 25185 or 6261H.  The values of
  458.                'a' and 'b' are backwards because of the way the 8086
  459.                stores 16 bit numbers.
  460.        
  461.             D. Assembly constants.  These are special symbols that return
  462.                a value set by the assembler.  See Assembly Constants.
  463.        
  464.         II. Register operands.
  465.        
  466.             A. One of the following 8 bit registers:
  467.        
  468.                 AH  AL  BH  BL  CH  CL  DH  DL
  469.        
  470.  
  471.        Operands                                                        11
  472.        
  473.             B. One of the following 16 bit registers:
  474.        
  475.                 AX  BX  CX  DX  SP  BP  SI  DI
  476.        
  477.             C. One of the following segment registers:
  478.        
  479.                 CS  SS  DS  ES
  480.        
  481.        III. Memory operands.
  482.        
  483.             A. Direct addressing with a value enclosed by brackets.  All
  484.                numbers (immediate data) inside the brackets are added or
  485.                subtracted together to form the value.
  486.        
  487.             B. Indirect addressing through the use of one of the
  488.                following register combinations with an optional value
  489.                added or subtracted in:
  490.        
  491.                 BX  BP  DI  SI
  492.        
  493.                 BX+DI  BX+SI  BP+DI  BP+SI
  494.        
  495.                All the addressing components should be surrounded by
  496.                brackets.  The registers can appear in any order and may
  497.                be mixed up with any numbers.  All numbers (immediate
  498.                data) are added or subtracted together to form the value.
  499.                The OFFSET function is assumed for any labels (OFFSET can
  500.                be left out).
  501.        
  502.         IV. A string of any sequence of characters surrounded by single
  503.             quotes.  Note: single quotes cannot be represented as a
  504.             character in a string or as an immediate data character, it
  505.             can only be represented as a numerical value.
  506.        
  507.          V. A single question mark.  This means the the programmer
  508.             doesn't know or care what the operand is.  A question mark is
  509.             interpreted as a zero.
  510.        
  511.         VI. Certain symbols types are used as operands, including equates
  512.             and labels.  See Symbols.
  513.        
  514.        VII. Functional operands may be used to modify or isolate specific
  515.             aspects of of other operands.  See Functional Operands.
  516.        
  517.        Operands always have a size associated with them (measured in
  518.        bits).  If the instruction is one that transfers data from one
  519.        operand to another, the sizes of the operands for the instruction
  520.        must agree.
  521.        
  522.        The size of immediate data is the number bits it represents.
  523.        Usually 8 bits of immediate data is compatible with 16 bits (i.e
  524.        WASM is smart enough to extend 8 bits of data into 16 bits).
  525.        
  526.  
  527.        12                                                        Operands
  528.        
  529.        Immediate data sizes:
  530.        
  531.          Immediate Data                 Size in Bits
  532.          --------------                 ------------
  533.          unsigned number 0 to 255         8 or 16
  534.          signed number -128 to 127        8 or 16
  535.          character in quotes              8 or 16
  536.          unsigned number 0 to 65535       16
  537.          signed number -32728 to 32727    16
  538.          double character in quotes       16
  539.        
  540.        The size of register and memory operands are the number of bits
  541.        that can be moved in and out of them.  The size of registers are
  542.        predefined.  The size of memory operands must be defined in the
  543.        declaration or with a functional operand that sets the size.  If a
  544.        memory operand is being operating upon with a register, the memory
  545.        operand is assumed to be the same size as the register.
  546.        
  547.        Examples of operands:
  548.        
  549.          ;*** Immediate Data ***
  550.        
  551.           Mov Dh, -100
  552.           Mov Bl, 00101001b
  553.           Mov Al,'W'     ;move the ASCII value of upper-case w to AL
  554.        
  555.           Mov Ax,', '    ;move a comma and space into AX,
  556.           Stosw          ;it is stored in the same order (comma first)
  557.        
  558.          ;remember that numbers MUST start with 0 to 9, even
  559.          ;hexadecimal numbers
  560.           Mov Ax,0ffffh  ;move ffff hex to AX
  561.        
  562.          ;*** Registers ***
  563.        
  564.          ;8 bit examples
  565.           Mov AL,DL
  566.           Mov CL,0
  567.        
  568.          ;16 bit examples
  569.           Mov Ax,Dx
  570.           Mov Cx,0
  571.        
  572.          ;segment examples
  573.           Mov Dx,Ss
  574.           Mov Cx,0   ;
  575.           Mov Es,Cx  ;cannot move immed. directly to seg
  576.        
  577.  
  578.        Operands                                                        13
  579.        
  580.          ;*** Memory operands ***
  581.        
  582.          ;direct reference examples
  583.           Mov [100],Ax           ;size is the same as AX
  584.           Mov Byte [100], 0      ;size is set with BYTE
  585.           Push Data              ;DATA is defined below, not ambiguous
  586.           Mov Data,0
  587.        
  588.          ;the next three produce the same effect
  589.           Mov CX,[Data]          ;OFFSET implied
  590.           Mov CX,[Offset Data]
  591.           Mov CX,Data            ;this is best
  592.        
  593.          ;indirect reference examples
  594.           Mov [Bx],Ax
  595.           Mov Dx,[Bx+Si+100]
  596.           Inc Byte [Offset Data+Di-1001011b+Bp-3]
  597.           Mov Cx, [Data+Bx]      ;BX acts as an index into DATA
  598.        
  599.          Data Dw  ?
  600.        
  601.          ;*** Near labels ***
  602.        
  603.          Label1                  ;no code, points to line below
  604.          Lable2  Label   Near    ;a label declaration, same as above
  605.          Label3  Nop             ;points to its own instruction
  606.          ;
  607.          ;all three of these jump to the NOP instruction above
  608.           Jmps Label1
  609.           Jmps Label2
  610.           Jmps Label3
  611.        
  612.          ;*** Strings ***
  613.        
  614.           Db 'this is a string'
  615.           Db 'it',39,'s cold'    ;this declares the string "it's cold"
  616.        
  617.  
  618.        14                                             Operand Expressions
  619.        
  620.                                Operand Expression
  621.        
  622.        Immediate data operands may be combined into expressions.  Any
  623.        number of operands may be combined sequentially.  Parenthesis may
  624.        also be used within expressions to control the order of
  625.        evaluation.  Parenthesis can be nested approximately ten deep.  A
  626.        sign may come before parenthesis, but the range of the value
  627.        within the parenthesis is not checked.  All operand expressions
  628.        are evaluated during assembly.
  629.        
  630.        Near and memory labels may also be modified via expressions.  Any
  631.        immediate data operands may be combined with a near or memory
  632.        label.  Adding or subtracting a value to or from a label has the
  633.        effect of an additional displacement.  The label must be the first
  634.        component of the expression.
  635.        
  636.        The legal operators for combining operands are:
  637.        
  638.          Operator  Function
  639.          --------  --------
  640.             +      addition        <--)  Arithmetic
  641.             -      subtraction        )
  642.             *      multiplication     )
  643.             /      division           )
  644.             \      remainder          )
  645.             MOD    remainder       <--)
  646.             AND    and             <----)  Logic
  647.             OR     or                   )
  648.             XOR    xor             <----)
  649.             =      equals          <------)  Conditional
  650.             <      less than              )
  651.             >      greater than    <------)
  652.        
  653.        The use of conditional operators are described under Conditional
  654.        Operators, the other operators carry out the specified standard
  655.        arithmetic and logic operations.  If some sort of error occurs
  656.        with AND, OR, XOR, or MOD, instead of displaying the literal
  657.        operator, only the first letter A, O, X, or \ for MOD will be
  658.        displayed.
  659.        
  660.        Examples of operand expressions:
  661.        
  662.          ;the following lines all assemble to "move zero to AX"
  663.           Mov Ax,0
  664.           Mov Ax,-21 + ((20 Mod 19)+ 20)
  665.           Mov Ax,-21 - -21
  666.           Mov Ax,50000 * (10\10)
  667.           Mov Ax,-6 / -3 - 2
  668.           Mov Ax,Not (1111111111111110b Or (0feh Xor (65535 And 1)))
  669.           Mov Ax,0ffh-128-64-32-16-8-4-2-1
  670.        
  671.  
  672.        Operand Expressions                                             15
  673.        
  674.          ;here is how to load a double word
  675.          ;of storage a word at a time
  676.           Mov Word Location, Offset Routine   ;load first word
  677.           Mov Ax, Ds
  678.           Mov Word Location + 2, Ax           ;load second word
  679.        
  680.          Location Label Dword
  681.           Ds 4
  682.        
  683.  
  684.        16                                               Program Structure
  685.        
  686.                                 Program Structure
  687.        
  688.        Though programs may be organized in any fashion, it is usually a
  689.        good idea to make them "structured."  Structured programs are
  690.        generally easier to understand and modify.  Because of their
  691.        inherently straightforward design, structured programs are less
  692.        likely to contain errors and usually accomplish the task with a
  693.        minimum of code.
  694.        
  695.        Structured programming divides a program into separate routines,
  696.        each of which is treated like a separate program.  Every routine
  697.        encompasses a single or group of functions that make up the total
  698.        operation of the program.  Direct transfer of control from one
  699.        routine to another is not allowed.  Direct communication between
  700.        routines is also not allowed.  A routine may call another routine,
  701.        but when the other routine is finished, control must be returned
  702.        to the caller.  Information should only be passed from a routine
  703.        to its subroutine by parameters or by data that is explicitly
  704.        intended as global.
  705.        
  706.        Assembly language doesn't naturally lend itself to structured
  707.        programming the way a high-level language like Pascal does.  There
  708.        is nothing to prevent the programmer from entering a routine and
  709.        then jumping directly to another routine.  WASM provides two
  710.        methods to assist in creating a structured program: procedures and
  711.        macros.  The implementation for procedures and macros are
  712.        described under Procedures and Macros, respectively.
  713.        
  714.  
  715.        Procedures                                                      17
  716.        
  717.                                    Procedures
  718.        
  719.        A procedure is a type of programmer defined routine.  A procedure
  720.        is accessed with the 8086 CALL instruction.  Only one copy of a
  721.        procedure exists, unlike macros, which, in the process of
  722.        assembly, create a copy of their routine every time they are
  723.        invoked.  The use of procedures makes a program shorter but
  724.        slower.  Lengthy routines should always be declared as procedures,
  725.        especially if they are called in many different places.
  726.        Parameters are passed to procedures through registers or by
  727.        placing the data on the stack.
  728.        
  729.        Procedures are implemented by the PROC and ENDP directives.  PROC
  730.        starts a procedure.  Its operand is either NEAR, for routines in
  731.        the same segment, or FAR, for routines that may be in another
  732.        segment.  All procedures that are called from within the program
  733.        should be NEAR.  FAR should be used by procedures that will be
  734.        called externally from another program, like a machine language
  735.        BASIC subroutine, or for routines that are called indirectly, like
  736.        an interrupt handler.  A symbol may be declared along with the
  737.        PROC directive.  This symbol becomes the label that identifies the
  738.        procedure and is used when calling it.  ENDP finishes a procedure.
  739.        It has no operands.
  740.        
  741.        The last executed 8086 instruction in a procedure should be a RET.
  742.        This instruction will return control to the code that called the
  743.        routine in the first place.
  744.        
  745.        Procedures may be nested up to ten deep.  The nest number of a
  746.        procedure is displayed in the listing, see Assembly Listing.
  747.        Nesting a procedure doesn't really make it local, as is implied,
  748.        though it still should be treated as if it were.  Procedures
  749.        should not be called outside of the procedure that they were
  750.        declared in.  Also data declared inside of a procedure should not
  751.        be accessed outside of it.
  752.        
  753.        Procedural declarations create object code.  This means that the
  754.        program must either jump around them or the declarations must be
  755.        placed somewhere out of the way, like at the end of the program.
  756.        
  757.          ;small example of program structure and
  758.          ;syntax using procedures
  759.        
  760.          Main Proc Far   ;start of main program
  761.             :            ;main program
  762.           Call Subrt     ;transfer control to the subroutine
  763.             :            ;main program
  764.        
  765.          Subrt Proc Near ;start of subroutine declaration
  766.             :            ;subroutine code
  767.           Ret            ;returns control to main program
  768.           Endp           ;end of subroutine declaration
  769.        
  770.           Endp           ;end of main program
  771.        
  772.  
  773.        18                                            Conditional Assembly
  774.        
  775.                               Conditional Assembly
  776.        
  777.        Conditional assembly is to assemble or skip certain defined parts
  778.        of the source code based on programmer defined conditions.
  779.        Conditional assembly may be used anywhere within a program, to
  780.        enable or disable any sections of source code.  Source code that
  781.        is disabled (skipped) has no effect upon the assembly.
  782.        
  783.        Conditional assembly is probably most useful in macros, where the
  784.        programmer may want a macro to assemble in a certain way based
  785.        upon its parameters.
  786.        
  787.        Conditional assembly is controlled by special conditional
  788.        directives. These directives themselves never show up in the
  789.        listing.
  790.        
  791.  
  792.        Conditional Directives                                          19
  793.        
  794.                              Conditional Directives
  795.        
  796.        Conditional assembly is controlled by the IF, IFN, NEXTIF, ELSEIF,
  797.        ELSE, and ENDIF directives.  All conditional sections of code must
  798.        start with an IF or IFN and end with an ENDIF.  The other
  799.        directives, NEXTIF, ELSEIF, and ELSE, may optionally be used in
  800.        the middle.
  801.        
  802.        The IF directive starts a conditional section of code.  The IF
  803.        directive can be thought of as "if the condition is true, then
  804.        assemble the following code."  The "condition" for conditional
  805.        directives is a single immediate data operand.  The operand is
  806.        true if its value is not equal to zero, false if its value is
  807.        equal to zero.  If the condition is false, all the source code
  808.        after the IF is skipped up until a matching ENDIF or another
  809.        conditional statement is reached.
  810.        
  811.          ;IF is true, MOV AX,1 is assembled
  812.           If 9283    ;value not equal to zero, true
  813.            Mov Ax,1
  814.           Endif
  815.        
  816.          ;IF is false, ADD DX,CX is not assembled
  817.           If 0       ;value equal to zero, false
  818.            Add Dx,Cx
  819.           Endif
  820.        
  821.        The IFN directive works just like an IF directive except that the
  822.        condition is reversed.  IFN can be thought of as "if the condition
  823.        is not true then assemble the following code."  IFN starts a
  824.        section of conditional code, just like IF.
  825.        
  826.          ;the IFN condition is false, so the
  827.          ;MOV AX,1 is assembled
  828.           Ifn 0      ;value is zero, false
  829.            Mov Ax,1
  830.           Endif
  831.        
  832.          ;the IFN condition is true, ADD DX,CX
  833.          ;is not assembled
  834.           Ifn -6     ;value not equal to zero, true
  835.            Add Dx,Cx
  836.           Endif
  837.        
  838.        The NEXTIF directive works like an ENDIF/IF combination.  If a
  839.        NEXTIF is encountered, the present present conditional block of
  840.        code is finished (like an ENDIF) and a new conditional block is
  841.        started (like an IF).  NEXTIF, like IF, has a single conditional
  842.        operand.  Any number of NEXTIF's may follow an IF. NEXTIF's are
  843.        most useful for defining a sequential series of source code blocks
  844.        in situations where none, some, or all of the blocks may be
  845.        assembled or skipped.
  846.        
  847.  
  848.        20                                          Conditional Directives
  849.        
  850.          ;the NOP and SUB DI,SI are assembled
  851.           If 1
  852.            Nop
  853.           Nextif 0
  854.            Mov Ax,Dx
  855.           Nextif 1
  856.            Sub Di,Si
  857.           Endif
  858.        
  859.        The ELSEIF directive can be thought of as "if the previous IF was
  860.        false and if the condition is true, then assemble the following
  861.        code."  In other words, the conditional operand will only be
  862.        tested if the previous IF was false.  ELSEIF has a single
  863.        conditional operand.  Any number of ELSEIF's may follow an IF.
  864.        ELSEIF's are most useful for defining a sequential series of
  865.        source code blocks in situations where only one of the blocks will
  866.        be assembled and the remaining blocks skipped.
  867.        
  868.          ;the DEC AL is assembled
  869.           If 0
  870.            Nop
  871.           Elseif 1  ;previous IF=false and operand=true, true
  872.            Dec Al
  873.           Endif
  874.        
  875.          ;only the INC BP is assembled, the ELSEIF directives
  876.          ;default to false because the first IF is true
  877.           If 1
  878.            Inc Bp
  879.           Elseif 1
  880.            Nop
  881.           Elseif 1
  882.            Call Near [Ax]
  883.           Endif
  884.        
  885.          ;only the NOP is assembled
  886.           If 0
  887.            Inc Bp
  888.           Elseif 1
  889.            Nop
  890.           Elseif 1
  891.            Call Near [Bx]
  892.           Endif
  893.        
  894.        The ELSE directive is just like an ELSEIF directive where the
  895.        condition is always true.  The source code after the ELSE is
  896.        automatically assembled if the previous IF was false, otherwise
  897.        the source code is skipped.  Only a single ELSE should follow an
  898.        IF.  ELSE's are used when a section of code should be assembled
  899.        either one way or another.
  900.        
  901.  
  902.        Conditional Directives                                          21
  903.        
  904.          ;the SUB WORD [DI],6 is assembled
  905.           If 0
  906.            Mov Word [Di],0
  907.           Else
  908.            Sub Word [Di],6
  909.           Endif
  910.        
  911.        The NEXTIF, ELSEIF, and ELSE directives generally should not be
  912.        mixed together in a single conditional structure.  The only
  913.        exception may be using ELSEIF's or a single ELSE after a NEXTIF,
  914.        or a single ELSE after an ELSEIF.  Remember that all conditional
  915.        structures start with an IF and end with an ENDIF.  The ENDIF must
  916.        come after any intermediary conditional directives (NEXTIF,
  917.        ELSEIF, and ELSE).
  918.        
  919.          ;the SUB DI,10 and SUB SI,30 are assembled
  920.           If 1
  921.            Sub Di,10
  922.           Nextif 0
  923.            Add Si,20
  924.           Else
  925.            Sub Si,30
  926.           Endif
  927.        
  928.          ;the MOV DL,AL is assembled
  929.           If 0
  930.            Mov Dl,Cl
  931.           Elseif 0
  932.            Mov Dl,Bl
  933.           Else
  934.            Mov Dl,Al
  935.           Endif
  936.        
  937.  
  938.        22                                     Nested Conditional Assembly
  939.        
  940.                            Nested Conditional Assembly
  941.        
  942.        Conditional statements may be nested up to ten deep.  An IF or IFN
  943.        following an IF, IFN, NEXTIF, ELSEIF, or ELSE, but before the
  944.        ENDIF, starts a nested conditional structure.  The NEXTIF, ELSEIF,
  945.        ELSE, and ENDIF directives always match the last IF or IFN.  The
  946.        nested conditional code continues until its ENDIF is reached.
  947.        
  948.          ;only the last SUB DX,DX is assembled, the
  949.          ;remaining code is skipped because of the
  950.          ;initial false IF; comments on conditional
  951.          ;statements that say "true" or "false" are
  952.          ;actually evaluated, comments that say "skipped"
  953.          ;aren't evaluated because of a previous
  954.          ;false conditional statement
  955.           If 0             ;false
  956.            Add Dx,Dx
  957.            Ifn 0           ;skipped
  958.             Add Ax,Ax
  959.            Else            ;skipped
  960.             Sub Ax,Ax
  961.            Endif           ;end of nested code
  962.           Else             ;true
  963.            Sub Dx,Dx       ;line is assembled
  964.           Endif
  965.        
  966.  
  967.        Nested Conditional Assembly                                     23
  968.        
  969.          ;... and a more complicated nesting example,
  970.          ;only the ADD AX,AX is assembled
  971.           If 0             ;false
  972.            Nop
  973.           Elseif 0         ;false
  974.            Nop
  975.           Else             ;true
  976.            If 0            ;false
  977.             Nop
  978.             Ifn 0          ;skipped
  979.              Nop
  980.             Nextif 0       ;skipped
  981.              Nop
  982.             Else           ;skipped
  983.              Nop
  984.             Endif
  985.            Elseif 1        ;true
  986.             Ifn 1          ;false
  987.              Nop
  988.             Nextif 0       ;false
  989.              Nop
  990.             Nextif 1       ;true
  991.              If 1          ;true
  992.               Add Ax,Ax    ;line is assembled
  993.              Else          ;false
  994.               Nop
  995.              Endif
  996.             Endif
  997.            Elseif 1        ;false
  998.             Nop
  999.            Endif
  1000.           Endif
  1001.        
  1002.  
  1003.        24                                           Conditional Operators
  1004.        
  1005.                               Conditional Operators
  1006.        
  1007.        Conditional operators return a true or false value after comparing
  1008.        two immediate data operands.  Conditional operators are used for
  1009.        evaluating and comparing conditional operands.
  1010.        
  1011.        Conditional operators check for ranges or particular values
  1012.        through the use of: "<", ">", and "=".  They work like normal
  1013.        operators, except that they return either FFFFH for true or 0 for
  1014.        false.
  1015.        
  1016.          ;the SHR CX is assembled, since one is equal
  1017.          ;to one; it may seem silly to write "1=1",
  1018.          ;but maybe it was originally "Parm=1", inside
  1019.          ;of a macro, where PARM is a macro parameter that
  1020.          ;may be different each time the macro is called
  1021.           If 1=1
  1022.            Shr Cx
  1023.           Endif
  1024.        
  1025.          ;the SHR CX is assembled, only the 2<3 is true
  1026.           If 2 = 3
  1027.            Shr Ax
  1028.           Nextif 2 > 3
  1029.            Shr Bx
  1030.           Nextif 2 < 3
  1031.            Shr Cx
  1032.           Endif
  1033.        
  1034.          ;the CLC is assembled; the condition is true
  1035.          ;because (2>2) = 0, (2=2) = 0FFFFH, so the
  1036.          ;condition is the same as 0 OR 0FFFFH, which is
  1037.          ;equal to 0FFFFH, which is true; this construction
  1038.          ;creates a "greater or equal to" condition;
  1039.          ;all the various numerical comparisons can be
  1040.          ;created using conditional and logical operators
  1041.           If (2 > 2) Or (2 = 2)
  1042.            Clc
  1043.           Endif
  1044.        
  1045.  
  1046.        Conditional Operand Testing                                     25
  1047.        
  1048.                            Conditional Operand Testing
  1049.        
  1050.        The functions TYPE, VALUE, and SIZE are used to check for specific
  1051.        operand qualities.  Each of these functions return a 16 bit value
  1052.        that corresponds to a particular attribute of its argument.
  1053.        
  1054.        The type represents how the operand is interpreted (register,
  1055.        immediate data, near label, etc.).  The value may be a number to
  1056.        distinguish a register from another registers, the location of a
  1057.        label, or the actual value of an immediate data number.  The size
  1058.        is how many bits the register or memory location represents, or
  1059.        the number of bits that an immediate data number can represented
  1060.        by.  The type and size work on a bit by bit basis, that is, a
  1061.        particular bit represents a particular type or size.  An operand
  1062.        may be represented by more than one type or size (i.e. have
  1063.        multiple bits set).  Two operands are identical only if their
  1064.        type, value, and size are all identical.
  1065.        
  1066.        Operands can be tested for certain characteristics by comparing
  1067.        the bit settings to those of known operands.  It can be a bit
  1068.        tricky to test for the exact conditions you want, some
  1069.        experimentation may be necessary.  For the most part, if the any
  1070.        of the type or size bits match, the operands will be compatible in
  1071.        size or type.
  1072.        
  1073.        For the following examples, assume that P1 and P2 are macro
  1074.        parameters passed to the conditional statement:
  1075.        
  1076.          ;the following is true only if P1 and P2 are
  1077.          ;identical, the equates are used to make it
  1078.          ;fit all on one line
  1079.        
  1080.          P_Type Equ Type(P1) = Type(P2)
  1081.          P_Size Equ Size(P1) = Size(P2)
  1082.          P_Value Equ Value(P1) = Value(P2)
  1083.           If P_Type And P_Size And P_Value
  1084.        
  1085.          ;the following is true only if P1 is a non-
  1086.          ;segment register (a segment register is not
  1087.          ;not necessarily compatible with a normal
  1088.          ;register); only matching bits will make the
  1089.          ;result non-zero (true), and only
  1090.          ;non-segment registers have matching bits
  1091.           If Type(P1) And Type(Ax)
  1092.        
  1093.          ;the following is true only if P1 IS a
  1094.          ;segment register, the opposite of above
  1095.           If Type(P1) And Type(Ds)
  1096.        
  1097.  
  1098.        26                                     Conditional Operand Testing
  1099.        
  1100.          ;the following is true only if P1 is AX or
  1101.          ;AL; this statement is testing for equality,
  1102.          ;not just matching bits; a normal register
  1103.          ;wouldn't work because AX has an extra bit
  1104.          ;set (which defines it as the accumulator)
  1105.           If Type(P1) = Type(Ax)
  1106.        
  1107.          ;the following is true only if P1 is AL; like
  1108.          ;above, the accumulator type is tested for, but
  1109.          ;also the size must be the same as CH
  1110.           If (Type(P1) = Type(Ax)) And (Size(P1) = Size(Ch))
  1111.        
  1112.          ;you might think that the following is true if P1
  1113.          ;is any non-segment eight bit register, since it
  1114.          ;checks for compatible types and compatible sizes;
  1115.          ;unfortunately it doesn't necessarily work; the
  1116.          ;type and size comparisons each produce a bit
  1117.          ;pattern; those patterns individually, if
  1118.          ;compatible, are an arbitrary non-zero; there is
  1119.          ;no guarantee that these the two individually
  1120.          ;compatible bit patterns are compatible with
  1121.          ;each other
  1122.           If (Type(P1) And Type(Dx)) And (Size(P1) And Size(Dh))
  1123.        
  1124.          ;instead you can write the previous statement in
  1125.          ;the following manner; this statement, like the
  1126.          ;above, tests the size and type for compatibility,
  1127.          ;but then compares the result to zero; the type
  1128.          ;and size comparisons now return FFFFH if they
  1129.          ;are false (equal to zero), and 0 if they are
  1130.          ;true; now the two results can then be compared;
  1131.          ;since we want a positive result to be true,
  1132.          ;rather than a negative one, the entire
  1133.          ;expression must be placed within a NOT
  1134.           If Not((Type(P1) And Type(Dx)=0) And (Size(P1) And Size(Dh)=0))
  1135.        
  1136.          ;the above statement can more easily be written
  1137.          ;with the IFN directive as follows
  1138.           Ifn (Type(P1) And Type(Dx)=0) And (Size(P1) And Size(Dh)=0)
  1139.        
  1140.        More examples of conditional operand testing are provided under
  1141.        Conditional Macros.
  1142.        
  1143.  
  1144.        Macros                                                          27
  1145.        
  1146.                                      Macros
  1147.        
  1148.        A macro is a type of programmer defined routine.  A macro consists
  1149.        of a symbol that has some number of source lines assigned to it.
  1150.        The programmer creates a macro by assigning a section of code to a
  1151.        symbol.  Any time the assembler encounters the symbol as an
  1152.        instruction, the source code assigned to it is inserted into the
  1153.        program.  A macro may be used any number of times and at any
  1154.        location in the program.  In addition, the macro may have some
  1155.        number of "operands," which are passed as parameters to the
  1156.        inserted source code.  Macros are often used in conjunction with
  1157.        conditional assembly to create routines that adjust to different
  1158.        parameters.
  1159.        
  1160.        Macros are useful for inserting sections of code that are used
  1161.        several times in a single program.  Macros are also used to define
  1162.        a standard set of routines that are used by many different
  1163.        programs.  By including a file with commonly used macro
  1164.        declarations, the programmer can use only those macros that are
  1165.        needed by that particular program.  Macros only create object code
  1166.        by the source lines they insert, that is, the macro declarations
  1167.        themselves do not take up any space in the assembled program.
  1168.        
  1169.  
  1170.        28                                                 Defining Macros
  1171.        
  1172.                                  Defining Macros
  1173.        
  1174.        Macros may be defined anywhere within the program, except inside
  1175.        of other macro declarations.  The MACRO directive starts a macro
  1176.        declaration.  The required symbol declaration becomes the name of
  1177.        the macro.  Any number of operands may follow the MACRO directive.
  1178.        These operands are used to pass parameters into the macro.
  1179.        Whenever the macro is invoked, the parameter names are replaced
  1180.        (inside of the macro) by whatever corresponding operands where
  1181.        placed after the macro name.  The parameter names are local to the
  1182.        macro and need only be unique within that macro, otherwise all the
  1183.        normal restrictions to symbol declarations apply.  The parameters
  1184.        names should be single fields separated by commas (no expressions
  1185.        or functional operands).
  1186.        
  1187.        Any number of source lines may follow the MACRO directive.  Macro
  1188.        declarations are stored internally, and are thus limited by
  1189.        memory.  If the macro area becomes full, the assembly will
  1190.        terminate and display the appropriate error message.  The entire
  1191.        source line, including all spaces, non-standard control
  1192.        characters, and extended ASCII characters, are preserved
  1193.        throughout the macro storage and expansion.
  1194.        
  1195.        Symbols may be defined normally within macros.  Symbols defined
  1196.        within a macro are local and cannot be accessed outside of that
  1197.        macro.  The symbols need only be unique within that macro.  Local
  1198.        equates may be defined using the macro parameters.
  1199.        
  1200.        All 8086 instructions and assembly directives may be used within
  1201.        macros.  Macros may also be invoked within other macros.  You can
  1202.        even have a macro call itself recursively.  Conditional statements
  1203.        within macros apply to the overall conditional structure of the
  1204.        program, in other words, an ENDIF inside of a macro could be
  1205.        matched to an IF that appeared sometime outside and before the
  1206.        macro.  Note that macros are not expanded if they are in false
  1207.        conditional code, except for conditional macros, see Conditional
  1208.        Macros.
  1209.        
  1210.        A operand field inside of a macro may either be a parameter name,
  1211.        one of the predefined operand types, a local symbol, or a global
  1212.        symbol.  Parameter names take precedence over all other fields and
  1213.        are replaced before any interpretation occurs.  Local symbols take
  1214.        precedence over global symbols.  When specifying parameter names,
  1215.        if it is possible that the parameter will receive a nul string, it
  1216.        is a good idea to put parenthesis around the name.  This allows
  1217.        the line to be parsed correctly if a nul parameter is passed.
  1218.        
  1219.        Conditional statements can be used to test for valid parameters.
  1220.        If a parameter is not valid, it can be flagged with the ERROR
  1221.        directive.
  1222.        
  1223.        A macro declaration is ended by the ENDM directive.
  1224.        
  1225.  
  1226.        Defining Macros                                                 29
  1227.        
  1228.          ;defines a macro to move a value into segment
  1229.          ;register, especially immediate date, since
  1230.          ;immediate data cannot be moved directly into
  1231.          ;a segment register
  1232.        
  1233.          Mov_Seg Macro Segment_Reg, Location
  1234.           Push Ax
  1235.           Mov Ax, Location
  1236.           Mov Segment_Reg, Ax
  1237.           Pop Ax
  1238.           Endm
  1239.        
  1240.          ;defines a macro to execute an interrupt, also
  1241.          ;if a function number is provided, it is placed
  1242.          ;in AH; if the interrupt number is not immediate
  1243.          ;data, it is flagged.
  1244.        
  1245.          Interrupt Macro Int_Num, Func_Num
  1246.           If Type(Int_Num) And Type(0)
  1247.            Ifn Type(Func_Num) = Type()
  1248.             Mov Ah, Func_Num
  1249.            Endif
  1250.            Int Int_Num
  1251.           Else
  1252.            Error 'Interrupt must be immediate data'
  1253.           Endif
  1254.           Endm
  1255.        
  1256.  
  1257.        30                                                 Invoking Macros
  1258.        
  1259.                                  Invoking Macros
  1260.        
  1261.        Macros are invoked by using the macro name as an instruction.  Any
  1262.        operands will be passed as parameters.  The operands may be any
  1263.        kind, of any length, including expressions and functional
  1264.        operands.  Parameters are assigned in the order in which they were
  1265.        defined in the macro declaration.  Extra operands are ignored,
  1266.        missing parameters pass a nul string.  A parameter may be skipped
  1267.        and be assigned a nul string by placing a comma without an
  1268.        operand.
  1269.        
  1270.        Parameter names are blindly replaced in the macro source lines by
  1271.        their passed parameters.  Nul parameters simply remove the
  1272.        parameter name.  The resulting source line may be longer or
  1273.        shorter than the original.  Unnecessary spaces are removed from
  1274.        the parameters, so they may not look exactly the same in the
  1275.        source line as they did when they were first specified as
  1276.        operands.
  1277.        
  1278.        Macros are not normally expanded if the present source code is
  1279.        being skipped because of a false conditional statement.  Any
  1280.        conditional statements within that macro will be ignored.
  1281.        Conditional macros, on the other hand, are expanded under those
  1282.        circumstances, see Conditional Macros.
  1283.        
  1284.  
  1285.        Invoking Macros                                                 31
  1286.        
  1287.          ;defines a macro to declare three bytes, any
  1288.          ;missing parameters are declared as zero
  1289.        
  1290.          Dec_Bytes Macro Byte1, Byte2, Byte3
  1291.           Ifn Type(Byte1) = Type()
  1292.            Db Byte1
  1293.           Else
  1294.            Db 0
  1295.           Endif
  1296.           Ifn Type(Byte2) = Type()
  1297.            Db Byte2
  1298.           Else
  1299.            Db 0
  1300.           Endif
  1301.           Ifn Type(Byte3) = Type()
  1302.            Db Byte3
  1303.           Else
  1304.            Db 0
  1305.           Endif
  1306.           Endm
  1307.        
  1308.           Dec_Bytes         ;produces 000000
  1309.        
  1310.           Dec_Bytes 1       ;produces 010000
  1311.           Dec_Bytes ,2      ;produces 000200
  1312.           Dec_Bytes ,,3     ;produces 000003
  1313.        
  1314.           Dec_Bytes 1,2     ;produces 010200
  1315.           Dec_Bytes ,2,3    ;produces 000203
  1316.           Dec_Bytes 1,,3    ;produces 100003
  1317.        
  1318.           Dec_Bytes 1,2,3   ;produces 010203
  1319.        
  1320.  
  1321.        32                                                   Nested Macros
  1322.        
  1323.                                   Nested Macros
  1324.        
  1325.        Macros may be nested up to ten deep.  A macro invocation inside of
  1326.        another macro works no differently than any other macro
  1327.        invocation.  When the nested macros finishes, the original macro
  1328.        resumes.  A macro may even call itself recursively, though, unless
  1329.        the recursion is controlled by conditional statements, an error
  1330.        will occur when the maximum nest level is exceeded.
  1331.        
  1332.        Parameters may be passed to successive macro levels.  Local
  1333.        symbols within a macro cannot be accessed by any nested macros
  1334.        within it.
  1335.        
  1336.          ;defines a macro that uses recursion to produce
  1337.          ;a specified number of single shift right
  1338.          ;instructions, the macro calls itself as long as
  1339.          ;the count parameter is greater than zero; note
  1340.          ;that the count cannot exceed nine (assuming it is
  1341.          ;not called from within another macro), otherwise
  1342.          ;the macros will nest too deeply
  1343.        
  1344.          Shift_Right Macro Operand, Count
  1345.           If Count > 0
  1346.            Shr Operand
  1347.            Shift_Right Operand, Count-1
  1348.           Endif
  1349.           Endm
  1350.        
  1351.  
  1352.        Conditional Macros                                              33
  1353.        
  1354.                                Conditional Macros
  1355.        
  1356.        Conditional macros are similar to normal macros.  They are
  1357.        declared with MACROC instead of MACRO.  The purpose of conditional
  1358.        macros are to create custom conditional statements.  Conditional
  1359.        macros do three things that normal macros don't: the line invoking
  1360.        the macro is not listed (like like a conditional statement), the
  1361.        macro expansion is not listed (by an implicit EXPAND-), and the
  1362.        macros are expanded in false conditional code.  Generally one
  1363.        would declare the macro with just a single conditional line that
  1364.        expresses the relationship that is desired.
  1365.        
  1366.          ;defines an "if the parameter doesn't exist" statement by
  1367.          ;testing to see if the type returned for the parameter
  1368.          ;is the same as the type returned for a nul operand
  1369.        
  1370.          If_None Macroc Parameter
  1371.           If Type(Parameter) = Type()
  1372.           Endm
  1373.        
  1374.          ;defines an "if the parameter exists" statement
  1375.          ;by taking the opposite result of the declaration above
  1376.        
  1377.          If_Exist Macroc Parameter
  1378.           Ifn Type(Parameter) = Type()
  1379.           Endm
  1380.        
  1381.          ;defines an "if the parameter is a byte" statement
  1382.          ;by testing if any of the same size bits are set in the
  1383.          ;size of the parameter and the size of a byte value
  1384.        
  1385.          If_Byte Macroc Parameter
  1386.           If Size(Parameter) And Size(Byte 0)
  1387.           Endm
  1388.        
  1389.          ;defines an "if the sizes of the parameters are
  1390.          ;compatible" statement by testing for matching
  1391.          ;size bits
  1392.        
  1393.          If_Compatible_Size Macroc Parameter1, Parameter2
  1394.           If Size(Parameter1) And Size(Parameter2)
  1395.           Endm
  1396.        
  1397.          ;defines an "if the parameters are identical"
  1398.          ;statement testing if the type, value, and size
  1399.          ;are identical; equates are used to simplify and
  1400.          ;shorten the final statement
  1401.        
  1402.          If_Same Macroc Op1, Op2
  1403.          Stype Equ Type(Op1) = Type(Op2)
  1404.          Ssize Equ Size(Op1) = Size(Op2)
  1405.          Svalue Equ Value(Op1) = Value(Op2)
  1406.           If Stype And Ssize And Svalue
  1407.           Endm
  1408.        
  1409.  
  1410.        34                                               Listing of Macros
  1411.        
  1412.                                 Listing of Macros
  1413.        
  1414.        Macro expansions are listed like any other source line.  The
  1415.        special list indicator byte is a plus (+) in inserted macros
  1416.        lines.  The present macro nest level is displayed when the macro
  1417.        is first invoked.  This number is shown in the area normally
  1418.        reserved for the object code.  There is no way to tell when a
  1419.        nested macro ends within another macro.
  1420.        
  1421.        The listing of inserted macro lines may be globally suppressed or
  1422.        enabled with the EXPAND- and EXPAND+ directives.  The listing of
  1423.        individual macros may also be controlled by these directives.  If
  1424.        EXPAND- and EXPAND+ directives appear in a macro, they only affect
  1425.        that macro (and any nested macros).  EXPAND- and EXPAND+ do not
  1426.        have any effect if the source code is not otherwise being listed.
  1427.        Note that EXPAND- and EXPAND+ only affect the listing of macros,
  1428.        not the actual expansion of macros.
  1429.        
  1430.        Errors occurring within macro expansions are treated normally,
  1431.        except that the error message shows the last real line number and,
  1432.        if in an included file, the name of the source file.  The line
  1433.        number is in parenthesis following the error message.
  1434.        
  1435.          ;defines a macro that adds the parameters
  1436.          ;together and puts the result in DX; this
  1437.          ;macro is never listed because of the
  1438.          ;EXPAND-
  1439.        
  1440.          Adder Macro Parameter1, Parameter2
  1441.           Expand-
  1442.           Mov Dx,Parameter1
  1443.           Add Dx,Parameter2
  1444.           Endm
  1445.        
  1446.  
  1447.        Data                                                            35
  1448.        
  1449.                                       Data
  1450.        
  1451.        Data that is used by the program during execution must be placed
  1452.        in the program by declaration.  Data that is declared includes
  1453.        things like numbers and strings.  This is in contrast to the
  1454.        declaration of macros and equates which are only used when the
  1455.        program is assembled.  The DB, DW, and DS directives are used to
  1456.        make data declarations.
  1457.        
  1458.        DB is used to declare byte values, strings, words, and
  1459.        combinations of all three.  If a symbol is declared with the DB
  1460.        directive, it becomes an eight bit memory reference label.  The
  1461.        data declared by the DB may be accessed through the label.  Values
  1462.        are declared as bytes if possible, only if they must be words are
  1463.        they declared as words.  The BYTE and WORD functions may be used
  1464.        to explicitly set the number bits that DB data is declared as.
  1465.        
  1466.        DW is used to declare word values.  If a symbol is declared with
  1467.        the DW directive, it becomes a sixteen bit memory reference label.
  1468.        The data declared by the DW may be accessed through the label.
  1469.        Values are always declared as words, even if they may be bytes.
  1470.        
  1471.        DS is used to declare any number of identical bytes.  If a symbol
  1472.        is declared with the DS directive, the it becomes a memory
  1473.        reference label with no size.  The size should be specified
  1474.        whenever this label is accessed (via the size functions BYTE,
  1475.        WORD, DWORD, etc.).  The LABEL directive may be used to declare a
  1476.        label of a particular type and size immediately before the DS.
  1477.        
  1478.        Word values are always stored low byte first with the exception of
  1479.        two byte strings.  Assuming '1' = 31H and 'B' = 42H, the hex
  1480.        number 3142H will be stored as 4231H, though '1B' will be stored
  1481.        as 3142H.  The reverse format is how word numbers should be
  1482.        stored.  If for some reason a word value is stored as two separate
  1483.        bytes (using DB), the low byte should always be stored first,
  1484.        otherwise the number will be backwards for arithmetic operations.
  1485.        
  1486.        Declarations may be made anywhere in the program.  Since
  1487.        declarations produce non-executable object code, they should not
  1488.        be placed in a location where they might be interpreted as part of
  1489.        the code.  Branch the program around declarations, or put them at
  1490.        the end of the program or routine, after the executable code.
  1491.        
  1492.        Examples of data declarations:
  1493.        
  1494.          ;declare a byte
  1495.           Db -5
  1496.        
  1497.          ;declare a byte and then a word value
  1498.           Db Byte 0, Word 0
  1499.          ;... or just
  1500.           Db 0, Word 0
  1501.        
  1502.  
  1503.        36                                                            Data
  1504.        
  1505.          ;declare a string
  1506.           Db 'This is the string'
  1507.        
  1508.          ;declare some words
  1509.           Dw 0, 1, 2, 3, 65533, 65534, 65535
  1510.        
  1511.          ;the following declaration can be accessed through VALUES
  1512.          Values Db 100,-20, 36/10, 0, 010100110b
  1513.        
  1514.          ;this instruction accesses the numbers
  1515.          ;in VALUES above based on an index in BX
  1516.           Mov Al, [Values + Bx]  ;load number
  1517.        
  1518.          ;declare storage
  1519.           Ds 10          ;ten bytes of 00
  1520.           Ds 100, 0ffh   ;a hundred bytes of FFH
  1521.        
  1522.  
  1523.        Assembly Directives                                             37
  1524.        
  1525.                                Assembly Directives
  1526.        
  1527.        Assembly directives are instructions to control the assembly, they
  1528.        do not encode into 8086 machine language instructions, though some
  1529.        of the directives do produce object code.  Assembly directives are
  1530.        implemented the same way as normal instructions.
  1531.        
  1532.        This section describes all the assembly directives.  Most of the
  1533.        directives are also described in sections pertinent to their
  1534.        operation.
  1535.        
  1536.        The major categories of assembly directives are those that are
  1537.        used to declare symbols (EQU, LABEL, ORG), those that declare data
  1538.        (DB, DS, DW), those that declare procedures and macros (PROC,
  1539.        ENDP, MACRO, MACROC, ENDM), those used to control conditional
  1540.        assembly (ELSE, ELSEIF, ENDIF, IF, IFN, NEXTIF), those that
  1541.        control the assembly listing (EXPAND+, EXPAND-, LINSIZE, LIST+,
  1542.        LIST-, PAGE, PAGE+, PAGE-, PAGESIZE, SUBTITLE, SYMDUMP+, SYMDUMP-,
  1543.        TITLE), those that control error flagging and detection (ERROR,
  1544.        ERRORMAX, FLAGALL+, FLAGALL-, JUMP+, JUMP-, UNUSED+, UNUSED-), and
  1545.        some miscellaneous ones (INCLUDE, RESETC).
  1546.        
  1547.        ******************************************************************
  1548.        
  1549.        DB value/string, ...
  1550.        
  1551.        Declare byte.
  1552.        
  1553.        Places literal bytes of data into the assembled code.
  1554.        
  1555.        DB may have any number of operands, as long as they fit on the
  1556.        line.  The value of each operand is placed sequentially into the
  1557.        assembled code.  The operands can be immediate data or strings.
  1558.        Immediate data operands are declared as bytes if possible,
  1559.        otherwise they are declared as words.  Strings are inserted just
  1560.        as they appear (minus the string delimiters).
  1561.        
  1562.        See Data.
  1563.        
  1564.          ;the following declares a sentence with its
  1565.          ;length preceding it, including a carriage
  1566.          ;return and linefeed at the end of the sentence;
  1567.          ;the BYTE function is needed to make the length
  1568.          ;an explicit eight bit value
  1569.        
  1570.          A
  1571.           Db Byte(Offset B - Offset A - 1),'The sentence.',10,13
  1572.          B
  1573.        
  1574.          ;this declares a byte FFH and then a word FFFFH
  1575.           Db  -1, Word -1
  1576.        
  1577.  
  1578.        38                                             Assembly Directives
  1579.        
  1580.        ******************************************************************
  1581.        
  1582.        DS bytes [, value]
  1583.        
  1584.        Declare storage.
  1585.        
  1586.        Places some number of identically initialized bytes into the
  1587.        assembled code.
  1588.        
  1589.        DS can have one or two operands.  The first operand is the number
  1590.        of bytes to declare and the second is the value that the storage
  1591.        should be initialized to.  The initialization value is optional,
  1592.        and, if absent, the storage is initialized to zero.  The number of
  1593.        bytes to declare must be immediate data (0 to 65535).  The
  1594.        initialization value must be eight bit immediate data.
  1595.        
  1596.        See Data.
  1597.        
  1598.          ;declare a thousand bytes of FFH
  1599.           Ds 1000, 0ffh
  1600.        
  1601.        ******************************************************************
  1602.        
  1603.        DW value, ...
  1604.        
  1605.        Declare word.
  1606.        
  1607.        Places literal words of data into the assembled code.
  1608.        
  1609.        DW can have any number of operands, as long as they fit on the
  1610.        line.  The value of each operand is placed sequentially into the
  1611.        assembled code.  The operands must be immediate data.  The
  1612.        operands are always declared as words, even if they could be
  1613.        bytes.
  1614.        
  1615.        See Data.
  1616.        
  1617.          ;this sort of construction can be useful
  1618.          ;for creation a table of addresses, note
  1619.          ;that this particular example would work
  1620.          ;equally well with DB
  1621.           Dw Offset Subrt1, Offset Subrt2
  1622.        
  1623.        ******************************************************************
  1624.        
  1625.        ELSE
  1626.        
  1627.        Conditional "else."
  1628.        
  1629.        Assembles the following source code only if the previous IF
  1630.        directive was false.
  1631.        
  1632.        Requires no operands.
  1633.        
  1634.  
  1635.        Assembly Directives                                             39
  1636.        
  1637.        See Conditional Assembly.
  1638.        
  1639.          ;the code after the ELSE is carried out
  1640.          ;if NUMBER is not greater than 10
  1641.           If Number > 10
  1642.            Mov Ax, Bx
  1643.           Else
  1644.            Mov Bx, Ax
  1645.           Endif
  1646.        
  1647.        ******************************************************************
  1648.        
  1649.        ELSEIF condition
  1650.        
  1651.        Conditional "else if."
  1652.        
  1653.        Assembles the following source code only if the previous IF
  1654.        directive was false and the condition is true.
  1655.        
  1656.        ELSEIF requires a single immediate data operand.  This operand is
  1657.        the condition to test.
  1658.        
  1659.        See Conditional Assembly.
  1660.        
  1661.          ;only one of the following are true:
  1662.          ;if OPTION is equal to zero, CALL SUBRT1 is
  1663.          ;assembled; if OPTION is equal to one,
  1664.          ;CALL SUBRT2 is assembled; if OPTION is equal
  1665.          ;to two, CALL SUBRT3 is assembled
  1666.           If Option=0
  1667.            Call Subrt1
  1668.           Elseif Option=1
  1669.            Call Subrt2
  1670.           Elseif Option=2
  1671.            Call Subrt3
  1672.           Endif
  1673.        
  1674.        ******************************************************************
  1675.        
  1676.        ENDIF
  1677.        
  1678.        End of conditional structure.
  1679.        
  1680.        Finishes a conditional structure started by an IF directive.
  1681.        
  1682.        Requires no operands.
  1683.        
  1684.        See Conditional Assembly.
  1685.        
  1686.  
  1687.        40                                             Assembly Directives
  1688.        
  1689.          ;ENDIF finishes the conditional structure,
  1690.          ;so the CLC is assembled no matter what
  1691.           If Type(Parameter)=Type(Ax)
  1692.            Sub Ax, Ax
  1693.           Endif
  1694.           Clc
  1695.        
  1696.        ******************************************************************
  1697.        
  1698.        ENDM
  1699.        
  1700.        End of macro.
  1701.        
  1702.        Finishes a macro declaration started by a MACRO or MACROC
  1703.        directive.
  1704.        
  1705.        Requires no operands.
  1706.        
  1707.        See Macros.
  1708.        
  1709.          ;the ENDM finishes the rather simple declaration
  1710.          ;of the macro NUL_INST
  1711.        
  1712.          Nul_Inst Macro
  1713.           Nop
  1714.           Endm
  1715.        
  1716.        ******************************************************************
  1717.        
  1718.        ENDP
  1719.        
  1720.        End of procedure.
  1721.        
  1722.        Finishes a procedure declaration started by a PROC directive.
  1723.        
  1724.        Requires no operands.
  1725.        
  1726.        See Procedures.
  1727.        
  1728.          ;the ENDP finishes the declaration of the
  1729.          ;procedure SUBRT
  1730.        
  1731.          Subrt Proc Near
  1732.           Xchg Ax, [Si]
  1733.           Ret
  1734.           Endp
  1735.        
  1736.        ******************************************************************
  1737.        
  1738.        EQU value
  1739.        
  1740.        Equate a value.
  1741.        
  1742.  
  1743.        Assembly Directives                                             41
  1744.        
  1745.        Defines a symbol that may be used anywhere in place of a specified
  1746.        value.
  1747.        
  1748.        EQU requires a single immediate data operand and the symbol to be
  1749.        equated.  The operand becomes equated to the symbol.
  1750.        
  1751.        EQU is useful for making the source code more readable by
  1752.        replacing arbitrary numbers with meaningful symbols.  The value of
  1753.        the equate generally should not reference any symbols that have
  1754.        not been defined yet in the source code.  This means that the
  1755.        value should not contain a forward reference to another equate, or
  1756.        use OFFSET when its argument has not yet been defined.
  1757.        
  1758.        See Symbols.
  1759.        
  1760.          ;equate the number 50 times 20, or 1000, to the
  1761.          ;symbol NUMBER, and then move NUMBER into AX
  1762.        
  1763.          Number Equ 50*20
  1764.           Mov Ax, Number
  1765.        
  1766.        ******************************************************************
  1767.        
  1768.        ERROR message
  1769.        
  1770.        Programmer defined error.
  1771.        
  1772.        Causes an error to occur using the specified message.
  1773.        
  1774.        ERROR requires a single string operand.  This operand becomes the
  1775.        error message.
  1776.        
  1777.        No line is displayed with the error message, the listing of the
  1778.        statement itself is suppressed.  The error is included in total
  1779.        number of errors at the end of the program.  ERROR is useful for
  1780.        flagging invalid macro parameters.
  1781.        
  1782.          ;defines a macro that checks for a missing operand;
  1783.          ;if the macro is invoked with the operand is missing,
  1784.          ;an error is displayed using an ERROR directive
  1785.        
  1786.          Mover Macro Op1
  1787.           If Type(Op1) = Type()
  1788.            Error 'Missing operand'
  1789.           Endif
  1790.           Endm
  1791.        
  1792.          ;this will cause the error
  1793.           Mover       ;invoked with no operands
  1794.        
  1795.  
  1796.        42                                             Assembly Directives
  1797.        
  1798.        ******************************************************************
  1799.        
  1800.        ERRORMAX number
  1801.        
  1802.        Maximum errors.
  1803.        
  1804.        Places an upper limit on the number of errors and comments
  1805.        occurring before the assembly is halted.
  1806.        
  1807.        ERRORMAX requires a single immediate data operand.  This operand
  1808.        becomes the new number of maximum allowed errors.
  1809.        
  1810.        The default is 65535.  Note that both errors and comments are
  1811.        counted.
  1812.        
  1813.          ;set the number of allowed errors to ten, if a tenth error
  1814.          ;or comment ever occurs, the assembly will be terminated
  1815.           Errormax 10
  1816.        
  1817.        ******************************************************************
  1818.        
  1819.        EXPAND+ 
  1820.        EXPAND-
  1821.        
  1822.        List macro expansions.
  1823.        
  1824.        When activated (EXPAND+), lines resulting from a macro expansion
  1825.        will be listed.  When deactivated (EXPAND-), lines resulting from
  1826.        a macro expansion will not be listed, only the line containing the
  1827.        macro invocation will be visible.
  1828.        
  1829.        Requires no operands.
  1830.        
  1831.        The default is EXPAND+.  EXPAND+ and EXPAND- directives that are
  1832.        within macros only apply to those macros.  Macros will not be
  1833.        listed regardless of the EXPAND+ and EXPAND- directives if the
  1834.        source code is not otherwise being listed.
  1835.        
  1836.        See Macros and Assembly Listing.
  1837.        
  1838.          ;macro expansions are globally listed because
  1839.          ;of the EXPAND+, except the defined macro TERMINATE
  1840.          ;explicitly suppresses only its own listing
  1841.           Expand+
  1842.        
  1843.          Terminate Macro
  1844.           Expand-
  1845.           Mov Ah, 4ch
  1846.           Int 21h
  1847.           Endm
  1848.        
  1849.  
  1850.        Assembly Directives                                             43
  1851.        
  1852.        ******************************************************************
  1853.        
  1854.        FLAGALL+ 
  1855.        FLAGALL-
  1856.        
  1857.        Undefined symbol flagging.
  1858.        
  1859.        When activated (FLAGALL+), an undefined symbol is flagged each
  1860.        time it is used, even if it has been flagged before.  When
  1861.        deactivated (FLAGALL-), an undefined symbol is only flagged the
  1862.        first time it is used.
  1863.        
  1864.        Requires no operands.
  1865.        
  1866.        The default is FLAGALL-.
  1867.        
  1868.          ;assuming BADSYM is undefined, it is flagged when
  1869.          ;it is moved to AX and BX, but not when it is
  1870.          ;moved to CX or DX, since it has been flagged
  1871.          ;previously and because of the FLAGALL-
  1872.           Flagall+
  1873.           Mov Ax, Badsym
  1874.           Mov Bx, Badsym
  1875.           Flagall-
  1876.           Mov Cx, Badsym
  1877.           Mov Dx, Badsym
  1878.        
  1879.        ******************************************************************
  1880.        
  1881.        IF condition
  1882.        
  1883.        Conditional "if."
  1884.        
  1885.        Assembles the following source code only if the condition is true.
  1886.        
  1887.        IF requires a single immediate data operand.  This operand is the
  1888.        condition to test.
  1889.        
  1890.        The IF directive starts a conditional structure. See Conditional
  1891.        Assembly.
  1892.        
  1893.          ;if COND is zero, the IN AX,DX will be assembled
  1894.           If Not(Cond)
  1895.            In Ax, Dx
  1896.           Endif
  1897.        
  1898.        ******************************************************************
  1899.        
  1900.        IFN condition
  1901.        
  1902.        Conditional "if not."
  1903.        
  1904.        Assembles the following source code only if the condition is
  1905.        false.
  1906.        
  1907.  
  1908.        44                                             Assembly Directives
  1909.        
  1910.        IFN requires a single immediate data operand.  This operand is the
  1911.        condition to test.
  1912.        
  1913.        The IFN directive starts a conditional structure.  IFN is the
  1914.        opposite of IF.  See Conditional Assembly.
  1915.        
  1916.          ;if COND is zero, the OUT DX,AX will be assembled
  1917.           If Cond
  1918.            Out Dx, Ax
  1919.           Endif
  1920.        
  1921.        ******************************************************************
  1922.        
  1923.        INCLUDE file
  1924.        
  1925.        Include source file.
  1926.        
  1927.        The specified file is inserted into the main source code
  1928.        immediately after the INCLUDE directive.
  1929.        
  1930.        INCLUDE requires a single string operand.  This operand should
  1931.        contain the name of the file to insert.  If no path is specified,
  1932.        the main source file path is used.  If no extension is specified,
  1933.        the extension of ASM is used.
  1934.        
  1935.        The included source code is not treated any differently than the
  1936.        rest of the program.  Included files may NOT be nested, which
  1937.        means that the file being inserted may not contain any INCLUDE
  1938.        directives.  Neither may INCLUDE's be used within macros.  INCLUDE
  1939.        is useful for inserting source code used by many different
  1940.        programs, like standard macro declarations.  INCLUDE can also be
  1941.        used to break up a source file into several smaller chunks, if,
  1942.        for instance, your text editor cannot handle the entire source
  1943.        file at once.
  1944.        
  1945.          ;the following directive inserts the file
  1946.          ;INCLUDE.INC, the source drive and path are
  1947.          ;used
  1948.           Include 'Source.Inc'
  1949.        
  1950.        ******************************************************************
  1951.        
  1952.        JUMP+ 
  1953.        JUMP-
  1954.        
  1955.        Short jump checking.
  1956.        
  1957.        When activated (JUMP+), all long near jump instructions will be
  1958.        flagged if a short near jump could be substituted.  When
  1959.        deactivated (JUMP-), long jumps that could be short jumps are not
  1960.        flagged.
  1961.        
  1962.        Requires no operands.
  1963.        
  1964.  
  1965.        Assembly Directives                                             45
  1966.        
  1967.        The default is JUMP-.  Substituting a short jump for a long jump
  1968.        does not logically change the program, but does make the assembled
  1969.        code one byte shorter.
  1970.        
  1971.          ;both of the following jumps could be
  1972.          ;JMPS (a short unconditional jump); the
  1973.          ;first JMP LABEL is not flagged, the
  1974.          ;second one is
  1975.           Jump-
  1976.           Jmp Label
  1977.           Jump+
  1978.           Jmp Label
  1979.          Label
  1980.        
  1981.        ******************************************************************
  1982.        
  1983.        LABEL type
  1984.        
  1985.        Label declaration.
  1986.        
  1987.        Defines a branch or memory reference label using the present
  1988.        location counter.
  1989.        
  1990.        LABEL requires a single operand and a symbol to be defined.  The
  1991.        operand NEAR or FAR is used for branch locations.  The operand
  1992.        BYTE, WORD, or DWORD is used for memory references of eight,
  1993.        sixteen, or thirty-two bit sizes, respectively.
  1994.        
  1995.        Explicitly defining a symbol as NEAR has the same effect as
  1996.        placing a symbol on an otherwise empty line or a line with some
  1997.        sort of operation (not a data declaration).  Explicitly declaring
  1998.        a symbol as BYTE or WORD has the same effect as placing a symbol
  1999.        on a byte (DB) or  word (DW) data declaration.  LABEL can be used
  2000.        in conjunction with the ORG directive to define labels independent
  2001.        of the actual code being assembled.
  2002.        
  2003.        See Symbols.
  2004.        
  2005.          ;this label ...
  2006.          Bran1 Label Near
  2007.          ;...is the same type as
  2008.          Bran2 Mov Ds, Dx
  2009.        
  2010.          ;and this ...
  2011.          Dat1 Label Word
  2012.          ;... produces the same sort of label as ...
  2013.          Dat2 Dw ?
  2014.        
  2015.  
  2016.        46                                             Assembly Directives
  2017.        
  2018.          ;the following causes MEM_SIZE to point at the word
  2019.          ;in program segment prefix that tells how many bytes
  2020.          ;are available in the segment; if you use this method
  2021.          ;to define any labels, make sure to reset the location
  2022.          ;counter back to its proper value before defining any
  2023.          ;other normal labels in the program
  2024.           Org 6
  2025.          Mem_Size Label Word
  2026.        
  2027.        ******************************************************************
  2028.        
  2029.        LINESIZE [length] [, code, ...]
  2030.        
  2031.        List line length.
  2032.        
  2033.        Sets the maximum number of characters in each list line.
  2034.        
  2035.        The optional first operand is the list line length.  The remaining
  2036.        optional eight bit immediate data operands are printer codes.
  2037.        These printer codes are sent directly to the printer if the list
  2038.        file is PRN.
  2039.        
  2040.        The default is 79.  The length must be in the range 45 to 158.
  2041.        The number of characters per line should only be set once in a
  2042.        program, though multiple LINESIZE directives may be used to send
  2043.        several bunches of printer codes.  If a list line would come out
  2044.        any longer than specified by the LINESIZE, it will be truncated.
  2045.        PAGESIZE can also be used to set the number of characters per
  2046.        line.
  2047.        
  2048.        See Assembly Listing.
  2049.        
  2050.          ;set up for IBM Graphics printer compressed font, the
  2051.          ;printer code (15) is sent if PRN is the list file
  2052.           Linesize 131, 15
  2053.        
  2054.        ******************************************************************
  2055.        
  2056.        LIST+ 
  2057.        LIST-
  2058.        
  2059.        Assembly listing.
  2060.        
  2061.        When activated (LIST+), a listing of the program will be
  2062.        generated.  When deactivated (LIST-), no listing will be
  2063.        generated.
  2064.        
  2065.        Requires no operands.
  2066.        
  2067.  
  2068.        Assembly Directives                                             47
  2069.        
  2070.        If a list file was specified at the start of the program, the
  2071.        default is LIST+.  If no list file was specified, no list will be
  2072.        generated (regardless of any LIST+ or LIST- directives).  LIST+
  2073.        and LIST- directives that are within included files only affect
  2074.        those files, so you could, for instance, place a LIST- at the
  2075.        start of a source file to be included and just have the listing of
  2076.        that file suppressed.  LIST+ and LIST- directives are useful for
  2077.        selectively listing isolated sections of the source code.
  2078.        
  2079.        See Assembly Listing.
  2080.        
  2081.          ;turn list off, NOP's are not listed
  2082.           List-
  2083.           Nop
  2084.           Nop
  2085.          ;turn list on, NOP's are listed
  2086.           List+
  2087.           Nop
  2088.           Nop
  2089.        
  2090.        ******************************************************************
  2091.        
  2092.        MACRO [parameter, ...]
  2093.        
  2094.        Macro declaration.
  2095.        
  2096.        Begins a macro declaration that will be finished by the ENDM
  2097.        directive.
  2098.        
  2099.        MACRO may have up to ten operands.  These operands must be unique
  2100.        symbols within the macro declaration.  The operands become the
  2101.        names of any parameters passed to the macro upon invocation.  A
  2102.        symbol declaration to name the macro is also required.
  2103.        
  2104.        See Macros.
  2105.        
  2106.          ;defines the macro LOAD_DS, the MACRO
  2107.          ;directive starts the declaration
  2108.        
  2109.          Load_DS Macro Op1
  2110.           Mov Ax, Op1
  2111.           Mov Ds, Ax
  2112.           Endm
  2113.        
  2114.        ******************************************************************
  2115.        
  2116.        MACROC [parameter, ...]
  2117.        
  2118.        Conditional macro declaration.
  2119.        
  2120.        Begins a conditional macro declaration that will be finished by
  2121.        the ENDM directive.
  2122.        
  2123.  
  2124.        48                                             Assembly Directives
  2125.        
  2126.        MACROC may have up to ten operands.  These operands must be unique
  2127.        symbols within the macro declaration.  The operands become the
  2128.        names of any parameters passed to the macro upon invocation.  A
  2129.        symbol declaration to name the macro is also required.
  2130.        
  2131.        See Conditional Macros.
  2132.        
  2133.          ;defines a conditional directive TOO_SMALL
  2134.          ;that is false if the operand is above ten,
  2135.          ;i.e. "if not above ten then do the following"
  2136.        
  2137.          Too_Small Macroc Op1
  2138.           Ifn Op1 > 10
  2139.           Endm
  2140.        
  2141.          ;with the above declaration, the ADD AX,AX
  2142.          ;will be assembled because 11 is above 10
  2143.           Too_Small 11
  2144.            Sub Ax, Ax
  2145.           Else
  2146.            Add Ax, Ax
  2147.           Endif
  2148.        
  2149.        ******************************************************************
  2150.        
  2151.        NEXTIF condition
  2152.        
  2153.        Conditional "if", same level.
  2154.        
  2155.        Finishes the present conditional block and starts a new one.
  2156.        Assembles the following source code only if the condition is true.
  2157.        
  2158.        NEXTIF requires a single immediate data operand.  This operand is
  2159.        the condition to test.
  2160.        
  2161.        See Conditional Assembly.
  2162.        
  2163.          ;any or all of the following may be true:
  2164.          ;if OPTION is equal to ten, CALL SUBRT1 is
  2165.          ;assembled; if OPTION is less than ten,
  2166.          ;CALL SUBRT2 is assembled; if OPTION is greater
  2167.          ;than ten, CALL SUBRT3 is assembled
  2168.           If Option=10
  2169.            Call Subrt1
  2170.           Nextif Option<10
  2171.            Call Subrt2
  2172.           Nextif Option>10
  2173.            Call Subrt3
  2174.           Endif
  2175.        
  2176.  
  2177.        Assembly Directives                                             49
  2178.        
  2179.        ******************************************************************
  2180.        
  2181.        ORG value
  2182.        
  2183.        Origin.
  2184.        
  2185.        Sets the location counter to the specified value.
  2186.        
  2187.        ORG requires a single immediate data operand.  This operand
  2188.        becomes the new location counter value.  If the operand is signed,
  2189.        the value is treated as a displacement to the present location.
  2190.        
  2191.        The default is 100H, which is the starting offset required for COM
  2192.        programs.  ORG affects the location assigned to labels.  ORG can
  2193.        be used to set the offset of specially defined labels.
  2194.        
  2195.          ;this declares three consecutive memory labels, note
  2196.          ;that these declarations only create the labels and do
  2197.          ;not allow space for them in the object code, this sort
  2198.          ;of thing could be done at the end of the program to
  2199.          ;create uninitialized data locations in memory
  2200.        
  2201.          Data1 Label Word
  2202.             Org $+2
  2203.          Data2 Label Word
  2204.             Org $+2
  2205.          Data3 Label Word
  2206.             Org $+2
  2207.        
  2208.          ;remember that signed numbers are treated as displacements
  2209.        
  2210.             Org 2      ;(unsigned, absolute)
  2211.          Symbol1       ;this symbol points to [0002]
  2212.             Org +2     ;(signed, displacement)
  2213.          Symbol2       ;this symbol points to [0004], two past the
  2214.                        ;location above
  2215.        
  2216.        ******************************************************************
  2217.        
  2218.        PAGE [page|subtitle] 
  2219.        PAGE page [, subtitle]
  2220.        
  2221.        New page.
  2222.        
  2223.        Starts a new list page regardless of whether paging is on or off,
  2224.        or what the size of the previous page was.
  2225.        
  2226.        PAGE may have none, one, or two operands.  If the first operand is
  2227.        immediate data, it becomes the new page number.  If the first
  2228.        operand a string, it becomes the new page subtitle.  If both a
  2229.        page number and a subtitle are included, the page number must come
  2230.        first.
  2231.        
  2232.  
  2233.        50                                             Assembly Directives
  2234.        
  2235.        If the page number is not specified, the previous page number is
  2236.        incremented.  If the subtitle is not included, the subtitle from
  2237.        the previous page is used.  PAGE can be used in conjunction with
  2238.        automatic paging (PAGE+) to start a new section of the code with a
  2239.        new subtitle.
  2240.        
  2241.        See Assembly Listing.
  2242.        
  2243.          ;start a new page and set the page number
  2244.          ;to ten and the subtitle to "Page ten"
  2245.           Page 10, 'Page ten'
  2246.        
  2247.        ******************************************************************
  2248.        
  2249.        PAGE+ [page|subtitle] 
  2250.        PAGE+ page [, subtitle] 
  2251.        PAGE-
  2252.        
  2253.        Automatic paging.
  2254.        
  2255.        When automatic paging is activated (PAGE+), a new page is started
  2256.        after every number of lines specified by the PAGESIZE directive
  2257.        (default 60).  When automatic paging is not activated (PAGE-), no
  2258.        paging is done, except by the PAGE directive.  PAGE+ automatically
  2259.        starts a new page if there are operands (i.e. a page number,
  2260.        subtitle, or both).
  2261.        
  2262.        PAGE+ has operands identical to those of PAGE, see PAGE above.
  2263.        PAGE- requires no operands.
  2264.        
  2265.        Default is PAGE-.  Paging can make the listing of a program look
  2266.        better if a hard copy is printed out on separate pages.
  2267.        
  2268.        See Assembly Listing.
  2269.        
  2270.          ;activate auto paging, start a new page, and
  2271.          ;set the subtitle to "Start of Paging"
  2272.           Page+ 'Start of Paging'
  2273.        
  2274.        ******************************************************************
  2275.        
  2276.        PAGESIZE lines [, characters ]
  2277.        
  2278.        Page size.
  2279.        
  2280.        Sets the lines per page and the maximum number of characters per
  2281.        line.  The lines per page affect the number lines output before a
  2282.        new page is started when automatic paging (PAGE+) is active.  The
  2283.        characters per line affect the final length of each list line.
  2284.        
  2285.        PAGESIZE may have one or two immediate data operands.  The first
  2286.        operand becomes the number of lines per page.  The second operand
  2287.        is optional and is the number of characters per line.
  2288.        
  2289.  
  2290.        Assembly Directives                                             51
  2291.        
  2292.        The default lines per page is 60.  The default characters per line
  2293.        is 79.  The lines per page must be in the range 15 to 255 and the
  2294.        characters per line must be in the range 45 to 158.  The number of
  2295.        lines per page and the number of characters per line should only
  2296.        be set once in a program.  The number of characters per line can
  2297.        also be set with LINESIZE.
  2298.        
  2299.          ;this makes for very long pages
  2300.           Pagesize 200
  2301.        
  2302.          ;the following two lines would have the same effect,
  2303.           Pagesize ,50   ;note that the first operand is nul
  2304.          ;Linsize 50     ;characters per line should only be set once
  2305.        
  2306.        ******************************************************************
  2307.        
  2308.        PROC type
  2309.        
  2310.        Procedure declaration.
  2311.        
  2312.        Begin a procedure declaration that will be finished by the ENDP
  2313.        directive.
  2314.        
  2315.        PROC requires a single operand.  This operand is NEAR for near
  2316.        procedures and FAR for far procedures.
  2317.        
  2318.        Far procedures should only be used for routines that will be
  2319.        called by other programs or are called indirectly.  Far procedures
  2320.        cannot be called locally via a CALL instruction.  The type of
  2321.        procedure determines how the returns (RET instructions) within the
  2322.        procedure will be encoded.
  2323.        
  2324.        See Procedures.
  2325.        
  2326.          ;the procedure ORRER is defined, the PROC
  2327.          ;directive starts the declaration
  2328.        
  2329.          Orrer Proc Near
  2330.           Or Cx, 10101b
  2331.           Ret
  2332.           Endp
  2333.        
  2334.        ******************************************************************
  2335.        
  2336.        RESETC [count] [,checksum]
  2337.        
  2338.        Reset counter.
  2339.        
  2340.        Resets the counter ($COUNT) and counter checksum ($SUM).
  2341.        
  2342.  
  2343.        52                                             Assembly Directives
  2344.        
  2345.        RESETC may have none, one, or two immediate data operands.  Both
  2346.        operands are optional.  If the first operand is present, it
  2347.        becomes the new count value.  If the second operand is present, it
  2348.        becomes the new checksum value.  If an operand is missing, zero is
  2349.        used.
  2350.        
  2351.        The new values take effect on the line after the RESETC directive.
  2352.        This directive does not affect the program byte count ($SIZE) or
  2353.        checksum ($CHKSUM).
  2354.        
  2355.           Resetc         ;set count and checksum to zero
  2356.           Mov Ax, $Count ;will load zero to AX
  2357.           Resetc ,20     ;default (zero) for count, 20 for checksum
  2358.           Mov Ax, $Sum   ;will load 20 to AX
  2359.        
  2360.        ******************************************************************
  2361.        
  2362.        SUBTITLE subtitle
  2363.        
  2364.        Program subtitle.
  2365.        
  2366.        Defines the page subtitle for all subsequent pages.
  2367.        
  2368.        SUBTITLE requires a single string operand.  The operand becomes
  2369.        the subtitle.
  2370.        
  2371.        Note that SUBTITLE sets the subtitle for all pages following the
  2372.        present one, not the page in which the SUBTITLE directive appears.
  2373.        The PAGE, PAGE+, and TITLE directives can also be used to set the
  2374.        subtitle.
  2375.        
  2376.        See Assembly Listing.
  2377.        
  2378.          ;set the subtitle of the following pages
  2379.          ;to "Input and Output Routines"
  2380.           Subtitle 'Input and Output Routines'
  2381.        
  2382.        ******************************************************************
  2383.        
  2384.        SYMDUMP+ 
  2385.        SYMDUMP-
  2386.        
  2387.        Symbol table dump.
  2388.        
  2389.        When activated (SYMDUMP+), the symbol table will be displayed at
  2390.        the end of the listing.  When not activated (SYMDUMP-), the symbol
  2391.        table will not be displayed.
  2392.        
  2393.        Requires no operands.
  2394.        
  2395.        The default is SYMDUMP-.  There is only one symbol dump at the end
  2396.        of the program, i.e. there is no reason to turn the symbol table
  2397.        dump on and then turn it off later.
  2398.        
  2399.  
  2400.        Assembly Directives                                             53
  2401.        
  2402.        See Symbol Table Listing.
  2403.        
  2404.          ;enable symbol dump at the end
  2405.          ;of the program
  2406.           Symdump+
  2407.        
  2408.        ******************************************************************
  2409.        
  2410.        TITLE title [,subtitle]
  2411.        
  2412.        Program title.
  2413.        
  2414.        Defines the page title for the entire program listing.  The
  2415.        starting page subtitle may also be specified.
  2416.        
  2417.        TITLE requires one or two operands.  The first operand becomes the
  2418.        program title.  The optional second operand becomes the subtitle.
  2419.        Both operands must be strings.
  2420.        
  2421.        Only one TITLE directive is valid for the entire program.  The
  2422.        TITLE directive is the only way to set the subtitle on the first
  2423.        page header, since SUBTITLE takes effect on the next page
  2424.        following the directive and PAGE and PAGE+ automatically start a
  2425.        new page.
  2426.        
  2427.        See Assembly Listing.
  2428.        
  2429.          ;set the program title to "Holy Cow" and the
  2430.          ;initial subtitle to "Initialize"
  2431.           Title 'Holy Cow', 'Initialize'
  2432.        
  2433.        ******************************************************************
  2434.        
  2435.        UNUSED+ 
  2436.        UNUSED-
  2437.        
  2438.        Unused symbol flagging.
  2439.        
  2440.        When active (UNUSED+), all symbols that were never accessed will
  2441.        be flagged.  When not active (UNUSED-), unused symbols will not be
  2442.        flagged.
  2443.        
  2444.        Requires no operands.
  2445.        
  2446.        Used to inform the programmer of unnecessary labels, routines,
  2447.        etc.  Unused macro declarations are never flagged.  The default is
  2448.        UNUSED-.
  2449.        
  2450.  
  2451.        54                                             Assembly Directives
  2452.        
  2453.          ;assuming the near labels SYM1 and SYM2 were
  2454.          ;never accessed, SYM1 is flagged and SYM2 isn't
  2455.           Unused-
  2456.          Sym1
  2457.           Unused+
  2458.          Sym2
  2459.        
  2460.        ******************************************************************
  2461.        
  2462.  
  2463.        Functional Operands                                             55
  2464.        
  2465.                                Functional Operands
  2466.        
  2467.        Functional operands modify another operand passed as an argument.
  2468.        Functional operands serve two general purposes: first to change a
  2469.        characteristic of an operand but still use it in more or less the
  2470.        same way, and second to isolate a specific aspect of an operand.
  2471.        All functional operands take another operand as an argument and
  2472.        can be used anywhere in place of a normal operand.
  2473.        
  2474.        The major categories of functional operands are those that set the
  2475.        size of its argument (ANYSIZE, BYTE, DWORD, QWORD, TBYTE, WORD),
  2476.        those that change the type of its argument (FAR, NEAR), those that
  2477.        change the value of its argument (NEG, NOT), and those that are
  2478.        used to access specific qualities of its argument (OFFSET, SIZE,
  2479.        TYPE, VALUE).
  2480.        
  2481.        ******************************************************************
  2482.        
  2483.        ANYSIZE
  2484.        
  2485.        Size any.
  2486.        
  2487.        Set the size of its argument to all allowable sizes.
  2488.        
  2489.        Its argument must be a memory operand or immediate data.  Can also
  2490.        be used with the LABEL directive.
  2491.        
  2492.          ;the following two statements do not
  2493.          ;conflict because of the ANYSIZE below
  2494.           Mov Bx, Data   ;move 16 bits
  2495.           Add Data, Al   ;add 8 bits
  2496.        
  2497.          Data Label Anysize   ;data label
  2498.           Dw ?                ;declare space for data
  2499.        
  2500.        ******************************************************************
  2501.        
  2502.        BYTE
  2503.        
  2504.        Size byte.
  2505.        
  2506.        Set the size of its argument to byte size (8 bit).
  2507.        
  2508.        Its argument must be a memory operand or immediate data.  Can also
  2509.        be used with the LABEL directive.  Used mainly to declare the
  2510.        number of bits acted upon in an operation if the operation would
  2511.        be ambiguous otherwise.
  2512.        
  2513.          ;the size of [SI] would be ambiguous
  2514.           Mov Byte [Si], 0   ;perform an 8 bit move
  2515.        
  2516.  
  2517.        56                                             Functional Operands
  2518.        
  2519.        ******************************************************************
  2520.        
  2521.        DWORD
  2522.        
  2523.        Size double word.
  2524.        
  2525.        Set the size of its argument to double word size (32 bit).
  2526.        
  2527.        Its argument must be a memory operand or immediate data.  Can also
  2528.        be used with the LABEL directive.  Used mainly to declare the
  2529.        number of bits acted upon in an operation if the operation would
  2530.        be ambiguous otherwise.
  2531.        
  2532.          ;make an intersegment call
  2533.           Call Routine_Location  ;call routine
  2534.        
  2535.          Routine_Location Label Dword   ;the location is 367A:6374
  2536.           Dw 06374h   ;offset
  2537.           Dw 0367ah   ;segment
  2538.        
  2539.        ******************************************************************
  2540.        
  2541.        FAR
  2542.        
  2543.        Type far label.
  2544.        
  2545.        Set the type of its argument to far label.
  2546.        
  2547.        Its argument must be a near label, far label, or memory operand.
  2548.        If its argument is a near or far label, the label is simply
  2549.        converted to a far label.  If its argument is a memory operand,
  2550.        FAR has the same effect as the DWORD function.  This allows FAR to
  2551.        be used in specifying indirect intersegment branching.  FAR is
  2552.        mainly used to declare a far procedure.
  2553.        
  2554.          ;execute an intersegment call, [BX] must point to a location
  2555.          ;containing the segment and offset of the subroutine to execute
  2556.           Call Far [Bx] ;transfer control to routine
  2557.        
  2558.          ;declare a rather insignificant far procedure, cannot
  2559.          ;be called directly, but may be an interrupt handler
  2560.        
  2561.          Subrt Proc Far  ;make far procedure
  2562.           Ret            ;return, don't do anything
  2563.           Endp           ;end of declaration
  2564.        
  2565.        ******************************************************************
  2566.        
  2567.        NEAR
  2568.        
  2569.        Type near label.
  2570.        
  2571.        Set the type of its argument to near label.
  2572.        
  2573.  
  2574.        Functional Operands                                             57
  2575.        
  2576.        Its argument must be a near label, far label, memory operand, or
  2577.        immediate data.  If its argument is a near or far label or
  2578.        immediate data, the operand is simply converted to a near label.
  2579.        If its argument is a memory operand, NEAR has the same effect as
  2580.        the WORD function.  This allows NEAR to be used in specifying
  2581.        indirect same segment branching.  NEAR is mainly used to declare a
  2582.        near procedure.
  2583.        
  2584.          ;execute a same segment call, DATA must point to a location
  2585.          ;containing the offset of the subroutine to execute
  2586.           Call Near Data ;transfer control to routine
  2587.        
  2588.          Data Ds 2       ;two bytes of storage (offset)
  2589.        
  2590.          ;declare a near procedure that doubles AX
  2591.        
  2592.          Double Proc Near ;make near procedure
  2593.           Sal Ax          ;double AX
  2594.           Ret             ;return
  2595.           Endp            ;end of procedure
  2596.        
  2597.          ;NEAR can be used to jump to a literal location
  2598.           Jmp Near 100h  ;branch to start of program
  2599.        
  2600.        ******************************************************************
  2601.        
  2602.        NEG
  2603.        
  2604.        Negate value.
  2605.        
  2606.        Perform an arithmetic negate on the value of its argument.
  2607.        
  2608.        Its argument must be immediate data.  Acts the same as a preceding
  2609.        sign, except that the validity of the result is not checked.
  2610.        
  2611.          ;the following two statements produce the same code
  2612.           Mov Dx, Neg 1 ;load minus one
  2613.           Mov Dx, -1    ;load minus one
  2614.        
  2615.          ;the following statement is really an undetected error
  2616.           Mov Dx, Neg 40000 ;-40000 cannot be represented with 16 bits
  2617.        
  2618.        ******************************************************************
  2619.        
  2620.        NOT
  2621.        
  2622.        Logical not of value.
  2623.        
  2624.        Perform a logical not on the value of its argument.
  2625.        
  2626.        Its argument must be immediate data.
  2627.        
  2628.  
  2629.        58                                             Functional Operands
  2630.        
  2631.          ;the following two statements produce the same code
  2632.           Mov Dh, Not 10101010b  ;load 55H
  2633.           Mov Dh, 01010101b      ;load 55H
  2634.        
  2635.        ******************************************************************
  2636.        
  2637.        OFFSET
  2638.        
  2639.        Offset of label.
  2640.        
  2641.        Return the offset of its argument.
  2642.        
  2643.        Its argument must be a near, far, or memory label.  The offset, or
  2644.        location, is returned as 16 bit immediate data.  Is mainly used by
  2645.        sections of code or individual routines which access data that may
  2646.        be any length (like strings of characters).
  2647.        
  2648.          ;put message location in SI
  2649.           Mov Si, Offset Start               ;location
  2650.          ;put message length in CX
  2651.           Mov Cx, Offset End - Offset Start  ;size
  2652.        
  2653.          Start Db 'This is the message'      ;message data
  2654.          End                                 ;end of message marker
  2655.        
  2656.        ******************************************************************
  2657.        
  2658.        QWORD
  2659.        
  2660.        Size quadruple word.
  2661.        
  2662.        Set the size of its argument to quadruple word (64 bit).
  2663.        
  2664.        Its argument must be a memory operand.  Not fully implemented,
  2665.        will be used for 8087 support.
  2666.        
  2667.        ******************************************************************
  2668.        
  2669.        SIZE
  2670.        
  2671.        Size of operand.
  2672.        
  2673.        Return the size of its argument.
  2674.        
  2675.        Its argument may be anything.  The size is returned as 16 bit
  2676.        immediate data for comparison with the size of other operands.
  2677.        See Conditional Operand Testing.
  2678.        
  2679.          ;the NOP is assembled if the sizes are identical
  2680.           If Size Ax = Size Symbol ;compare sizes
  2681.            Nop                ;code if true
  2682.           Endif               ;end of conditional
  2683.        
  2684.  
  2685.        Functional Operands                                             59
  2686.        
  2687.        ******************************************************************
  2688.        
  2689.        TBYTE
  2690.        
  2691.        Size ten byte.
  2692.        
  2693.        Set the size of its argument to ten bytes (80 bit).
  2694.        
  2695.        Its argument must be a memory operand.  Not fully implemented,
  2696.        will be used for 8087 support.
  2697.        
  2698.        ******************************************************************
  2699.        
  2700.        TYPE
  2701.        
  2702.        Type of operand.
  2703.        
  2704.        Return the type of its argument.
  2705.        
  2706.        Its argument may be anything.  The type is returned as 16 bit
  2707.        immediate data for comparison with the type of other operands.
  2708.        See Conditional Operand Testing.
  2709.        
  2710.          ;the NOP is assembled if the types are identical
  2711.           If Type Ax = Type Symbol ;compare types
  2712.            Nop                ;code if true
  2713.           Endif               ;end of conditional
  2714.        
  2715.        ******************************************************************
  2716.        
  2717.        WORD
  2718.        
  2719.        Size word.
  2720.        
  2721.        Set the size of its argument to word (16 bit).
  2722.        
  2723.        Its argument must be a memory operand or immediate data.  Can also
  2724.        be used with the LABEL directive.  Used mainly to declare the
  2725.        number of bits acted upon in an operation if the operation would
  2726.        be ambiguous otherwise.
  2727.        
  2728.          ;the size of [BX+SI-10] would be ambiguous
  2729.           Mov Word [Bx+Si-10], 0   ;perform a 16 bit move
  2730.        
  2731.        ******************************************************************
  2732.        
  2733.        VALUE
  2734.        
  2735.        Value of operand.
  2736.        
  2737.        Return the value of its argument.
  2738.        
  2739.  
  2740.        60                                             Functional Operands
  2741.        
  2742.        Its argument may be anything.  The value is returned as 16 bit
  2743.        immediate data for comparison with the value of other operands.
  2744.        See Conditional Operand Testing.
  2745.        
  2746.          ;the NOP is assembled if the values are identical
  2747.           If Value Ax = Value Symbol ;compare sizes
  2748.            Nop                ;code if true
  2749.           Endif               ;end of conditional
  2750.        
  2751.        ******************************************************************
  2752.        
  2753.  
  2754.        Assembly Constants                                              61
  2755.        
  2756.                                Assembly Constants
  2757.        
  2758.        Assembly constants are special symbols that are interpreted into
  2759.        immediate data during assembly.  Assembly constants may be used
  2760.        anywhere in place of immediate data.  Beware that these constants
  2761.        can cause an otherwise unexplained phase errors when used with
  2762.        instructions that directly manipulate the the location counter,
  2763.        like ORG.  Care should also be taken when using assembly constants
  2764.        with assembly directives that must control the assembly based on a
  2765.        value. Assembly constants may always be safely used as operands
  2766.        for 8086 instructions and in byte and word declarations (DB and
  2767.        DW).
  2768.        
  2769.        All symbols starting with a dollar sign are reserved as assembly
  2770.        constants.
  2771.        
  2772.        ******************************************************************
  2773.        
  2774.        $
  2775.        
  2776.        Present location.
  2777.        
  2778.        Returns the present value of the location counter.  Same as $LOC.
  2779.        May be safely used with the ORG directive.  16 bit.
  2780.        
  2781.          ;declares two memory labels that are ten bytes from each other
  2782.        
  2783.          Data_Area1 Label Byte   ;first label
  2784.                     Org $ + 10   ;advance location counter
  2785.          Data_Area2 Label Byte   ;second label
  2786.        
  2787.        ******************************************************************
  2788.        
  2789.        $CHKSUM
  2790.        
  2791.        Program checksum.
  2792.        
  2793.        Returns the byte checksum of the object code up to and including
  2794.        the previous source line.  8 bit.
  2795.        
  2796.        ******************************************************************
  2797.        
  2798.        $COUNT
  2799.        
  2800.        Byte count.
  2801.        
  2802.        Returns the number of bytes of code since the beginning of the
  2803.        program or the last RESETC directive.  16 bit.
  2804.        
  2805.  
  2806.        62                                              Assembly Constants
  2807.        
  2808.          ;branch around the string and then load its size
  2809.           Jmps Continue                  ;skip string
  2810.           Resetc                         ;reset counter
  2811.           Db 'Which way did he go?'      ;string declaration
  2812.          Continue                        ;continue execution
  2813.           Mov Cx, $Count                 ;load byte count
  2814.        
  2815.        ******************************************************************
  2816.        
  2817.        $DATE1
  2818.        
  2819.        Month and day.
  2820.        
  2821.        Returns the present day and month in the system format.  The high
  2822.        byte is the month (1 to 12) and the low byte is the day (1 to 31).
  2823.        16 bit.
  2824.        
  2825.        ******************************************************************
  2826.        
  2827.        $DATE2
  2828.        
  2829.        Year.
  2830.        
  2831.        Returns the present year in the system format.  The value is 1980
  2832.        to 2099.  16 bit.
  2833.        
  2834.        ******************************************************************
  2835.        
  2836.        $LOC
  2837.        
  2838.        Present location.
  2839.        
  2840.        Returns the present value of the location counter.  Same as $.
  2841.        May be safely used with the ORG directive.
  2842.        
  2843.        ******************************************************************
  2844.        
  2845.        $SIZE
  2846.        
  2847.        Program size.
  2848.        
  2849.        Returns the total size of the assembled program in bytes.  16 bit.
  2850.        
  2851.          ;load the size of the program into AX
  2852.           Mov Ax, $Size  ;load size
  2853.        
  2854.        ******************************************************************
  2855.        
  2856.        $SUM
  2857.        
  2858.        Counter checksum.
  2859.        
  2860.  
  2861.        Assembly Constants                                              63
  2862.        
  2863.        Returns the byte checksum of the object code up to and including
  2864.        the previous source line since the beginning of the program or the
  2865.        last RESETC.  8 bit.
  2866.        
  2867.        ******************************************************************
  2868.        
  2869.        $TIME1
  2870.        
  2871.        Second and 1/100 second.
  2872.        
  2873.        Returns the present second and 1/100 second in the system format.
  2874.        The high byte is the second (0 to 59) and the low byte is the
  2875.        1/100 second (0 to 99).  16 bit.
  2876.        
  2877.        ******************************************************************
  2878.        
  2879.        $TIME2
  2880.        
  2881.        Hour and minute.
  2882.        
  2883.        Returns the present hour and minute in the system format.  The
  2884.        high byte is the hour (0 to 23) and the low byte is the minute (0
  2885.        to 59).  16 bit.
  2886.        
  2887.        ******************************************************************
  2888.        
  2889.        $VERSION
  2890.        
  2891.        Assembler version.
  2892.        
  2893.        Returns the version number of the assembler.  The high byte is the
  2894.        minor version number and the low byte is the major version number.
  2895.        
  2896.          ;if assembling with WASM 2.14, AL get 2 and AH gets 14
  2897.           Mov Ax, $Version
  2898.        
  2899.        ******************************************************************
  2900.        
  2901.  
  2902.        64                                                Reserved Symbols
  2903.        
  2904.                                 Reserved Symbols
  2905.        
  2906.        The following are guidelines for what not to use as symbols.  All
  2907.        of these symbols have special meaning to WASM:
  2908.        
  2909.          AX      AL      ES       BYTE      OR
  2910.          CX      CL      CS       WORD      AND
  2911.          DX      DL      SS       DWORD     XOR
  2912.          BX      BL      DS       QWORD     MOD
  2913.          SP      AH      NOT      TBYTE     SIZE
  2914.          BP      CH      OFFSET   ANYSIZE   TYPE
  2915.          SI      DH      NEAR     ST        VALUE
  2916.          DI      BH      FAR      NEG
  2917.        
  2918.        A single question mark is also a reserved symbol.  All fields
  2919.        beginning with 0 to 9 are reserved for numbers.  All fields
  2920.        starting with a dollar sign ($) are reserved for assembly
  2921.        constants.  The following characters should never be used in
  2922.        symbols: control characters (ASCII 0 to 31), spaces, commas; and
  2923.        also any of the following: ; + - * = ' / \ ( ) < > [ ]  Macros
  2924.        should be unique from all other instructions, rather than the
  2925.        special symbols above.  It is recommended that programmer defined
  2926.        symbols start with a letter and consist of only letters, numbers,
  2927.        and underscores.
  2928.        
  2929.  
  2930.        Assembly Listing                                                65
  2931.        
  2932.                                 Assembly Listing
  2933.        
  2934.        The assembly listing is a comprehensive trace of the assembly and
  2935.        can be useful in debugging or making a hard copy of a program.  A
  2936.        listing is only generated if a list file is specified.  The
  2937.        assembly is speeded up if no list is generated.  A listing can be
  2938.        started or stopped with LIST+ and LIST- (these directives are
  2939.        ignored if no list file is specified).  The listing of macro
  2940.        expansion lines can be enabled with EXPAND+ (the default), or
  2941.        disabled with the EXPAND-.  Also a listing of the symbol table
  2942.        will be generated if a SYMDUMP+ is included somewhere in the
  2943.        program (see Symbol Table Listing).
  2944.        
  2945.        List directives within an included file only apply to the listing
  2946.        of that file, and expand directives within a macro only apply to
  2947.        the expansion of that macro.  This means you can place a LIST- at
  2948.        the start of an included file to suppress the listing of just that
  2949.        file. You can use an EXPAND- similarly to create a macro that is
  2950.        never expanded.
  2951.        
  2952.        The listing may be divided up into pages.  An individual page can
  2953.        be started with PAGE.  Automatic paging can be turned on with
  2954.        PAGE+ and turned off with PAGE- (the default).  The default page
  2955.        size is 60 lines (which includes a five line page header).  The
  2956.        page size can be modified with PAGESIZE.
  2957.        
  2958.        Each list page starts with a formfeed (ASCII 12) and a list
  2959.        header.  The formfeed is not included on the first page or on any
  2960.        pages of a listing sent to CON.  The list header consists of a
  2961.        programmer defined title and subtitle, the name of the main source
  2962.        file, the page number, the time and date, columnar headings for
  2963.        the list lines, and the assembler version.
  2964.        
  2965.        The title and subtitle are left justified in lines one and two
  2966.        respectively.  Only one title applies for an entire assembly
  2967.        listing.  Both the title and subtitle can be set with TITLE.  The
  2968.        subtitle can also be set with SUBTITLE, PAGE, and PAGE+.
  2969.        
  2970.        The source file name is displayed with the present page number,
  2971.        separated by a pair of dashes, right justified on the first line
  2972.        (opposite to the title).  Only the main source file name is
  2973.        displayed (never any included file names).  The page number starts
  2974.        at one and increments with each page.  The page number is never
  2975.        directly based on the pages within a source file (unlike list line
  2976.        numbers).  The page number can be set with PAGE and PAGE+.
  2977.        
  2978.        The time and date are right justified on the second line (opposite
  2979.        to the subtitle).
  2980.        
  2981.  
  2982.        66                                                Assembly Listing
  2983.        
  2984.        The columnar headings and the assembler version follow a blank
  2985.        line after the first two lines of the header (they are on line
  2986.        four).  In the columnar list headings: Loc stands for location
  2987.        counter, Obj stands for object code, Line stands for line number,
  2988.        and Source stands for source code.  The assembler version is
  2989.        justified to the right of the headings.
  2990.        
  2991.        The listing starts after another blank line (i.e. the sixth line
  2992.        of the page).  Each list line contains the location counter value
  2993.        (in hex), the object code for that line (also in hex), the source
  2994.        line number, a special indicator byte, and the source line itself.
  2995.        
  2996.        The location counter is not displayed if the line is blank or the
  2997.        location is not relevant to the instruction contained in that
  2998.        source line.
  2999.        
  3000.        No object code will be displayed if, of course, none is generated
  3001.        by the source line.  Some instructions (DS) never display their
  3002.        object code.  Procedure (PROC) and End-Procedure (ENDP) directives
  3003.        display the present procedure nest level instead.  Macros display
  3004.        the present macro nest level.
  3005.        
  3006.        The line number is always the actual line number within the source
  3007.        file.  Included source files maintain their own line numbering.
  3008.        You can use this number in your text editor to locate the line
  3009.        within its file.  Since macro expansion lines are not in the
  3010.        source file, no line number is displayed.
  3011.        
  3012.        The special indicator byte is a plus (+) for macro expansion
  3013.        lines, a minus (-) for included source files, and is blank
  3014.        otherwise.
  3015.        
  3016.        The source line is converted to upper-case (except for strings and
  3017.        comments), and will be truncated if necessary to make the entire
  3018.        list line the proper width.  The default width is 79.  The width
  3019.        can be modified with LINESIZE and PAGESIZE.  The LINESIZE
  3020.        directive can also be used to send special codes to your printer
  3021.        (with the purpose of setting a font).
  3022.        
  3023.        All the assembly directives mentioned in this description can be
  3024.        looked up under Assembly Directives.
  3025.        
  3026.  
  3027.        Symbol Table Listing                                            67
  3028.        
  3029.                               Symbol Table Listing
  3030.        
  3031.        A symbol table listing can be activated with SYMDUMP+.  The symbol
  3032.        table is listed at the very end of the assembly.  All symbols in
  3033.        the program are included, except symbols within macro expansions
  3034.        or declarations, and symbols that were defined in code that was
  3035.        skipped due to conditional assembly.
  3036.        
  3037.        The symbol table listing is divided five parts: Branch Locations,
  3038.        Memory References, Equated Values, Defined Macros, and Undefined
  3039.        Symbols.  Each section starts a new page.  The titles describing
  3040.        the section replace the normal columnar headings.
  3041.        
  3042.        The symbols are sorted alphabetically within each section.  For
  3043.        the purposes of alphabetization, underscores are ignored, for
  3044.        example: the symbol A_B carries the same weight as AB, both of
  3045.        these symbols would come after AA and before AC.  If a value is
  3046.        displayed with the symbol, it will be lined up to the right,
  3047.        expressed in hex.
  3048.        
  3049.        The branch locations section lists all the branch labels (types
  3050.        NEAR and FAR) within the program, including the names of
  3051.        procedures (which are just near labels).  Each symbol is
  3052.        accompanied by the location it represents.
  3053.        
  3054.        The memory reference section lists all the memory reference labels
  3055.        (type BYTE, WORD, etc.) within the program.  Each symbol is
  3056.        accompanied by the location it represents.
  3057.        
  3058.        The equated values section lists all the symbols defined by the
  3059.        EQU directive.  Each symbol is accompanied by the value it
  3060.        represents.
  3061.        
  3062.        The defined macros section lists all the macros that where defined
  3063.        within the program.  Every macro that was defined will be listed,
  3064.        whether or not it was used.
  3065.        
  3066.        The undefined symbols section lists all symbols that were used but
  3067.        not defined.
  3068.        
  3069.  
  3070.        68                                               Assembly Messages
  3071.        
  3072.                                 Assembly Messages
  3073.        
  3074.        The integrity of the source code is constantly checked during
  3075.        assembly.  Lines containing errors will be flagged with an
  3076.        appropriate error message.  Some lines are only flagged with a
  3077.        comment.  A comment is more of an observation than an error.
  3078.        Comments try to provide useful advice about the assembly.
  3079.        Comments are not included in the error count displayed at the end
  3080.        of assembly.
  3081.        
  3082.        Error and comment messages will be sent to the list file if a
  3083.        listing is being generated, otherwise the message will be
  3084.        displayed to the screen followed by the source line that caused
  3085.        the error or comment.  A line may be flagged with more than one
  3086.        message.  Paging occurs indiscriminately, so that error or comment
  3087.        messages may not appear on the same page as the line that they are
  3088.        flagging.
  3089.        
  3090.        Error messages start with "- - - Error: " and comment messages
  3091.        start with "- - - Comment: ".  Many error and comment messages are
  3092.        followed on the same line by sections of the source code or
  3093.        numbers.  Numbers will either be decimal or hexadecimal (followed
  3094.        by an "H").  If a line is flagged in an included file, the name of
  3095.        the file will appear in parenthesis following the message.  If a
  3096.        line is flagged in a macro expansion, the last source line number
  3097.        will appear in parenthesis.  If both of these conditions are true,
  3098.        then both the file name and line number will appear.
  3099.        
  3100.        Many times the thing that caused one error will cause others, so
  3101.        fixing up one error will often clear up others.  If the reasons
  3102.        for a particular error are unclear, try solving any previous
  3103.        errors first.
  3104.        
  3105.        Some errors may terminate the assembly.  If this happens, the
  3106.        message ">>>Cannot Continue<<<" will be displayed to the screen
  3107.        and the speaker will be sounded.
  3108.        
  3109.        Several assembly directives allow control over error flagging and
  3110.        detection.  The flagging of every undefined symbol occurrence can
  3111.        be activated or deactivated with FLAGALL+ and FLAGALL-; the
  3112.        detection of possible short unconditional jumps may be activated
  3113.        or deactivated with JUMP+ and JUMP-; and the flagging of unused
  3114.        symbols may be activated or deactivated with UNUSED+ and UNUSED-.
  3115.        A programmer defined error may be created with ERROR.  Finally,
  3116.        the maximum number of errors detected before the assembly is
  3117.        terminated can be controlled with ERRORMAX.  See Assembly
  3118.        Directives for more information on these directives.
  3119.        
  3120.        The following is a description of all assembly messages:
  3121.        
  3122.  
  3123.        Assembly Messages                                               69
  3124.        
  3125.        Address error
  3126.          There is some kind of error in an indirect memory operand.
  3127.          Probably an illegal combination of addressing registers.  The
  3128.          legal addressing register combinations are: BX, BP, DI, SI,
  3129.          BX+DI, BX+SI, BP+DI, and BP+SI.  Any of these combinations may
  3130.          also include an immediate data offset or displacement.
  3131.        
  3132.        Ambiguous memory reference
  3133.          A memory operand does not have its size properly specified.
  3134.          Usually occurs when the operands are a memory operand and
  3135.          immediate data and the size of the first is not defined.  Under
  3136.          those circumstances, the size of the memory operand should be
  3137.          defined with an explicit BYTE or WORD function.  This error also
  3138.          occurs if a LABEL directive is missing its operand.
  3139.        
  3140.        Cannot create list file: <file name>
  3141.          The list file could not be created or opened.  Probably because
  3142.          of an invalid file name.  The name of the list file is
  3143.          displayed.  Refer to the DOS manual for a description of legal
  3144.          file names.  Critical error.
  3145.        
  3146.        Cannot create object file: <file name>
  3147.          The object file could not be created or opened.  Probably
  3148.          because of an invalid file name.  The name of the object file is
  3149.          displayed.  Refer to the DOS manual for a description of legal
  3150.          file names.  Critical error.
  3151.        
  3152.        Could use JMPS: <displacement>
  3153.          The branch location is close enough so that a short
  3154.          unconditional jump (JMPS) instruction could be substituted for a
  3155.          normal jump (JMP).  The only effect this change would have is to
  3156.          shorten the resulting object code by one byte, i.e. the code is
  3157.          not incorrect the way it stands.  The flagging of possible short
  3158.          jumps is enabled with the JUMP+ directive.
  3159.        
  3160.        Data too long in declaration: <operand value>
  3161.          The initialization value (the second operand) of the DS
  3162.          directive is more than eight bits.  The value is displayed, it
  3163.          should be in the range 0 to 255.
  3164.        
  3165.        Disk full or write error: <file name>
  3166.          An error occurred in writing to the object or list file.
  3167.          Probably because the disk is full.  The name of the file in
  3168.          which the error occurred is displayed.  Make sure that the disk
  3169.          has enough free space, or send the object file or listing to
  3170.          another disk or device.  Critical error.
  3171.        
  3172.        Division by zero
  3173.          A division by zero occurred somewhere in an operand expression.
  3174.          The The value of the divisor must be changed to something other
  3175.          than zero.
  3176.        
  3177.  
  3178.        70                                               Assembly Messages
  3179.        
  3180.        Duplicate definition: <symbol>
  3181.          A symbol was declared more than once.  In addition to normal
  3182.          symbol declarations at the start of source lines, the parameter
  3183.          names after a MACRO directive are also considered symbol
  3184.          declarations (though only local to that macro).  Every duplicate
  3185.          definition of a symbol is flagged.  The symbol declarations must
  3186.          be changed so that they are all unique.  The symbol is
  3187.          displayed.
  3188.        
  3189.        ENDM without MACRO
  3190.          An ENDM directive was found without a corresponding MACRO or
  3191.          MACROC.
  3192.        
  3193.        ENDP without PROC
  3194.          An ENDP directive was found without a corresponding PROC.
  3195.        
  3196.        EQU without symbol
  3197.          The EQU directive was used without a symbol declaration.  An
  3198.          equate is meaningless without a symbol, thus a symbol
  3199.          declaration is required.
  3200.        
  3201.        IF statements nested too deeply: <maximum nest level>
  3202.          Conditional IF or IFN directives were nested too deeply.  The
  3203.          maximum nest level is displayed.
  3204.        
  3205.        Illegal addressing operand: <operand>
  3206.          An operand within brackets is not a valid addressing operand.
  3207.          The valid addressing operands are BX, BP, DI, SI, memory labels,
  3208.          and immediate data.  The operand is displayed.
  3209.        
  3210.        Illegal argument for ANYSIZE: <argument>
  3211.          The argument given for ANYSIZE is not valid.  The argument
  3212.          should be immediate data or a memory operand.  The argument is
  3213.          displayed.
  3214.        
  3215.        Illegal argument for BYTE: <argument>
  3216.          The argument given for BYTE is not valid.  The argument should
  3217.          be immediate data or a memory operand.  The argument is
  3218.          displayed.
  3219.        
  3220.        Illegal argument for DWORD: <argument>
  3221.          The argument given for DWORD is not valid.  The argument should
  3222.          be immediate data or a memory operand.  The argument is
  3223.          displayed.
  3224.        
  3225.        Illegal argument for FAR:
  3226.          The argument given for FAR is not valid.  The argument should be
  3227.          a near label, far label, or memory operand.  The argument is
  3228.          displayed.
  3229.        
  3230.        Illegal argument for NEAR: <argument>
  3231.          The argument given for NEAR is not valid.  The argument should
  3232.          be a near label, far label, memory operand, or immediate data.
  3233.          The argument is displayed.
  3234.        
  3235.  
  3236.        Assembly Messages                                               71
  3237.        
  3238.        Illegal argument for NEG: <argument>
  3239.          The argument given for NEG is not valid.  The argument should be
  3240.          immediate data.  The argument is displayed.
  3241.        
  3242.        Illegal argument for NOT: <argument>
  3243.          The argument given for NOT is not valid.  The argument should be
  3244.          immediate data.  The argument is displayed.
  3245.        
  3246.        Illegal argument for OFFSET: <argument>
  3247.          The argument given for OFFSET is not valid.  The argument should
  3248.          be a near label, far label, or memory label.  The argument is
  3249.          displayed.
  3250.        
  3251.        Illegal argument for QWORD: <argument>
  3252.          The argument given for QWORD is not valid.  The argument should
  3253.          be a memory operand.  The argument is displayed.
  3254.        
  3255.        Illegal argument for ST: <argument>
  3256.          The argument given for ST is not valid.  The argument should be
  3257.          immediate data.  ST, an 8087 stack operand, is not officially
  3258.          implemented.
  3259.        
  3260.        Illegal argument for TBYTE: <argument>
  3261.          The argument given for TBYTE is not valid.  The argument should
  3262.          be a memory operand.  The argument is displayed.
  3263.        
  3264.        Illegal argument for WORD: <argument>
  3265.          The argument given for WORD is not valid.  The argument should
  3266.          be immediate data or a memory operand.  The argument is
  3267.          displayed.
  3268.        
  3269.        Illegal number or symbol: <operand field>: <illegal character>
  3270.          An operand field started with a numerical digit (0 to 9), thus
  3271.          is interpreted as a number, but has an illegal character in it.
  3272.          Usually is a result of leaving the "H" off the end of
  3273.          hexadecimal numbers.  May also be the result of using a symbol
  3274.          that was inadvertently declared with a digit as its first
  3275.          character.  The operand field and the illegal character within
  3276.          it are displayed.
  3277.        
  3278.        Illegal operand in declaration: <operand>
  3279.          An operand in a DB or DW directive is invalid.  All DB operands
  3280.          must be immediate data or strings.  All DW operands must be
  3281.          immediate data.  The operand is displayed.
  3282.        
  3283.  
  3284.        72                                               Assembly Messages
  3285.        
  3286.        Illegal operand(s): <first type> <second type>
  3287.          One or both of the operands given for the instruction are
  3288.          not valid.  The first two operand types are displayed.  The
  3289.          valid operands for any given instruction may be looked up under
  3290.          Instruction Set.
  3291.        
  3292.          The following table shows the meaning of the displayed type
  3293.          bits.  Multiple bits may be active, like AX = 0006H (bits one
  3294.          and two):
  3295.        
  3296.          Bit  Operand Type
  3297.          ---  ------------
  3298.            0  no operand
  3299.            1  non-segment register
  3300.            2  accumulator (AX or AL)
  3301.            3  segment register
  3302.            4  memory operand in brackets
  3303.            5  immediate data
  3304.            6  string
  3305.            7  near label
  3306.            8  far label
  3307.            9  memory label
  3308.           10  (8087 stack)
  3309.           11  (8087 stack top)
  3310.           12  signed operand
  3311.           13  undefined symbol
  3312.           14  (internal use)
  3313.           15  (internal use)
  3314.        
  3315.        Illegal operator or symbol: <operator>
  3316.          One of the special delimiters was out of place or some sort of
  3317.          broader syntax error occurred in the operands of the
  3318.          instruction.  May be because of an illegal operand expression,
  3319.          like AX+1.  May be because of an extra operator, like 1+++1.
  3320.          May be because of a generally illegal construct, like (1+) or
  3321.          [OFFSET].  May be because of an illegal operator within a memory
  3322.          operand, like [5*3] or [1-BX].  May be because of illegal
  3323.          operators in the parameter names after the MACRO directive, like
  3324.          A+B.  The illegal character (operator) is displayed.  The
  3325.          operators AND, OR, XOR, and MOD will only show up as A, O, X,
  3326.          and \.
  3327.        
  3328.        Illegal printer code: <operand>
  3329.          A printer code following the LINESIZE directive is not valid.
  3330.          The printer codes must be 8 bit immediate data.
  3331.        
  3332.        Illegal reference: <value>
  3333.          The value of an equate changed during assembly and is thus not
  3334.          valid.  Probably because a changeable assembly constant was
  3335.          used, or the equate referenced an operand with OFFSET in it
  3336.          before the OFFSET argument was defined, or the equate referenced
  3337.          another, not yet defined equate.  The initial value of the
  3338.          equate is displayed.
  3339.        
  3340.  
  3341.        Assembly Messages                                               73
  3342.        
  3343.        Illegal use of MACRO symbol: <symbol>
  3344.          A macro symbol was used as an operand.  Macros may only be used
  3345.          as instructions.  The symbol is displayed.
  3346.        
  3347.        INCLUDE file not found: <file name>
  3348.          The include file could not be found or opened.  Probably because
  3349.          of an incorrect file name.  Make sure that all components of the
  3350.          file name are correct.  Remember that the source drive/path and
  3351.          an extension of ASM are assumed if not otherwise specified.  The
  3352.          name of the include file is displayed.
  3353.        
  3354.        INCLUDE's nested too deeply
  3355.          An INCLUDE directive inside of an included file was encountered.
  3356.          Include files may not be nested.
  3357.        
  3358.        INCLUDE within macro
  3359.          An INCLUDE directive inside of a macro expansion was detected.
  3360.          INCLUDE's may not be placed in macros.
  3361.        
  3362.        Invalid character in symbol: <symbol>
  3363.          The symbol being declared contains invalid character(s).
  3364.          Presently all symbols with a first character of "0" through "9"
  3365.          (reserved for numbers) or a first character of "$" (reserved for
  3366.          assembly constants) are flagged.  Macro parameter names
  3367.          (following a MACRO directive) can also be flagged in a similar
  3368.          manner.  The symbol must be changed so it conforms to the legal
  3369.          format.  The symbol is displayed.  See Reserved Symbols.
  3370.        
  3371.        Invalid operand size: <first size> <second size>
  3372.          No version of the instruction was found with matching operand
  3373.          sizes. This comment is provided to assist in fixing an Invalid
  3374.          Operands error.  The size of the first two operands are
  3375.          displayed. The valid operands and sizes for any given
  3376.          instruction may be looked up under Instruction Set.
  3377.        
  3378.          The following table shows the meaning of the displayed size
  3379.          bits.  Multiple bits may be active, like 5 = 0003H (bits zero
  3380.          and one):
  3381.        
  3382.          Bit  Operand Size
  3383.          ---  ------------
  3384.           0   8 bits, byte
  3385.           1   16 bits, word
  3386.           2   32 bits, double word
  3387.           3   64 bits, quadruple word
  3388.           4   80 bits, ten byte
  3389.        
  3390.          Bits 5 through 15 are for internal use.
  3391.        
  3392.        LABEL without label
  3393.          The LABEL directive was used without a symbol declaration.  A
  3394.          label declaration is meaningless without a symbol, thus a symbol
  3395.          is required.
  3396.        
  3397.  
  3398.        74                                               Assembly Messages
  3399.        
  3400.        Line size out of range: <specified size>
  3401.          The length of the line specified by a LINESIZE or PAGESIZE
  3402.          directive is either too small or too large.  The value must be
  3403.          in the range 45 to 158.  The value is displayed.
  3404.        
  3405.        MACRO without symbol
  3406.          The MACRO directive was used without a symbol declaration.  A
  3407.          macro declaration is meaningless without a symbol, thus a symbol
  3408.          is required.
  3409.        
  3410.        Macros nested too deeply: <maximum nest level>
  3411.          Macros are being expanded too deeply.  The maximum nest level is
  3412.          displayed.
  3413.        
  3414.        Missing ENDIF: <number>
  3415.          At least one ENDIF directive was found to be missing when the
  3416.          end of the source code was reached.  The number of missing
  3417.          ENDIF's are displayed.
  3418.        
  3419.        Missing ENDM
  3420.          An ENDM directive was found without a corresponding MACRO.
  3421.        
  3422.        Missing ENDP: <number>
  3423.          At least one ENDP directive was found to be missing when the end
  3424.          of the program was reached.  Since specific PROC's are not
  3425.          matched to specific ENDP's, the actual error may exist anywhere
  3426.          in the program, even though it isn't detected until the end of
  3427.          the program.  The number of missing ENDP's are displayed.
  3428.        
  3429.        Missing IF
  3430.          A NEXTIF, ELSEIF, ELSE, or ENDIF directive was found without a
  3431.          corresponding IF or IFN.  All conditional sections of source
  3432.          code must start with an IF or IFN.
  3433.        
  3434.        Missing or illegal operator: <field>
  3435.          Two fields were found not separated by a comma or valid
  3436.          operator.  Individual components of an operand expression must
  3437.          be separated by some kind of operator.  The individual operands
  3438.          of an instruction must be separated by commas.  Something like a
  3439.          misspelled AND operator could cause this error.  The second of
  3440.          the two fields are displayed.
  3441.        
  3442.        Missing PROC
  3443.          A RET instruction was found outside of a procedure.  Since the
  3444.          RET instruction needs a PROC directive to set the type of
  3445.          return, all RET's must fall within a procedure.  Near and far
  3446.          returns can be encoded independent of procedure definitions with
  3447.          RETN and RETF.
  3448.        
  3449.        Missing right bracket
  3450.          A memory operand using brackets came to an end without a right
  3451.          bracket (via an end of line or comma).  May occur because of a
  3452.          general error in syntax, like [OFFSET], where the bracket is
  3453.          passed to the OFFSET function as an argument and is overlooked.
  3454.        
  3455.  
  3456.        Assembly Messages                                               75
  3457.        
  3458.        Operand cannot be combined: <operand>
  3459.          The operand may not be used in an expression.  The operand is
  3460.          displayed.  Only immediate data may be used in expressions.
  3461.        
  3462.        Operands are incompatible sizes: <first size> <second size>
  3463.          The operands for the instruction are not compatible sizes,
  3464.          though the instruction involves exchanging data between the two.
  3465.          The sizes of the first two operands are displayed.  See the
  3466.          Invalid Operand Size error for a description of the size bits.
  3467.        
  3468.        Out of memory for code table: <maximum lines>
  3469.          The internal code table is full and no more lines can be
  3470.          assembled.  The maximum number of source lines that can be
  3471.          assembled is displayed.  See Memory Limitations.  Critical
  3472.          error.
  3473.        
  3474.        Out of memory for macro table: <bytes available>
  3475.          The internal macro storage area is full and no more macros can
  3476.          be defined.  The total available bytes of macro storage is
  3477.          displayed.  See Memory Limitations.  Critical error.
  3478.        
  3479.        Out of memory for symbol table: <symbol>: <bytes available>
  3480.          The internal symbol table is full and no more symbols may be
  3481.          defined.  The symbol that caused the error and the total
  3482.          available bytes for the symbol table is displayed.  See Memory
  3483.          Limitations.  Critical error.
  3484.        
  3485.        Overflow: <number>
  3486.          A number or the result of an expression is too big or too small.
  3487.          Individual numbers must be in the range 0 to 65535 (unsigned) or
  3488.          +32767 to -32768 (signed).  If any single value in an expression
  3489.          is signed, the entire expression is considered signed.  The
  3490.          final result of an expression must fall in the same unsigned or
  3491.          signed ranges as individual numbers.  If the error occurs
  3492.          because of an individual number, the number will be displayed.
  3493.        
  3494.        Page size out of range: <specified size>
  3495.          The length of the page specified by a PAGESIZE directive is
  3496.          either too small or too large.  The value must be in the range
  3497.          15 to 255. The value is displayed.
  3498.        
  3499.        Parenthesis nested too deeply
  3500.          The parenthesis in an operand expression were nested too deeply.
  3501.          Parenthesis may only be nested ten deep.
  3502.        
  3503.        Parenthetical error
  3504.          There was some kind of error in an operand expression involving
  3505.          parenthesis, like ((1).
  3506.        
  3507.  
  3508.        76                                               Assembly Messages
  3509.        
  3510.        Phase error: <previous value>
  3511.          The location counter somehow became out of phase with previous
  3512.          assembly passes.  The error may be occurring sometime previous
  3513.          to its detection, since the phase is only checked for symbol
  3514.          declarations (only labels).  This error probably means that the
  3515.          source code was assembled differently in different passes.
  3516.          Could be caused by something like conditionally assembling a
  3517.          section of the code based on the one of the time constants (like
  3518.          $TIME1), which may be different each pass.  Could also be caused
  3519.          by directly manipulating the location counter in an unsound
  3520.          fashion, like using assembly constants (which aren't really very
  3521.          constant) to set the location counter.  The previous location
  3522.          counter value is displayed.
  3523.        
  3524.        Procedures nested too deeply: <maximum nest level>
  3525.          Procedure declarations are nested too deeply.  The maximum nest
  3526.          level is displayed.
  3527.        
  3528.        Register size override: <first size> <second size>
  3529.          The size of the register is not compatible with the size of the
  3530.          memory operand.  The size of the memory operand may explicitly
  3531.          changed with a BYTE or WORD function.  The sizes of the first
  3532.          two operands are displayed.  See the Invalid Operand Size error
  3533.          for a description of the size bits.  This message doesn't
  3534.          necessarily indicate an error, but merely acts as a warning.
  3535.        
  3536.        Should be byte data
  3537.          The immediate data operand (port number) of an IN or OUT
  3538.          instruction is not eight bits.
  3539.        
  3540.        Source file not found: <file name>
  3541.          The source file could not be found or opened.  Probably because
  3542.          of an incorrectly typed file name.  Make sure that all
  3543.          components of the file name are correct.  Remember that the
  3544.          default drive/path and an extension of ASM are assumed if not
  3545.          otherwise specified.  The name of the source file is displayed.
  3546.          Critical error.
  3547.        
  3548.        Source line too long: <excess>
  3549.          The line within a macro expansion would be too long if all the
  3550.          parameters in that line were inserted.  The parameters or the
  3551.          line itself must be shortened.  The approximate amount by which
  3552.          the line is too long by is displayed.
  3553.        
  3554.        String not closed
  3555.          A string field was started with a single quote but not closed by
  3556.          a matching one.  A matching single quote must be added.
  3557.        
  3558.  
  3559.        Assembly Messages                                               77
  3560.        
  3561.        Too far for short jump: <displacement>
  3562.          The target of the branch is not close enough for a short jump
  3563.          (its displacement should be in the range +127 to -128, or 007F
  3564.          to FF80 hex).  If the instruction is a JMPS, then JMP may be
  3565.          used instead.  If the instruction is one of the conditional
  3566.          branches, the source code must be moved around so that target is
  3567.          closer, or a combination of conditional and unconditional
  3568.          branching must be used.  The present displacement is displayed.
  3569.        
  3570.            ;you could change the following ...
  3571.             Jz Toofar    ;TOOFAR is too far for a short jump
  3572.        
  3573.            ;... to the following
  3574.             Jnz Skipjump ;skip long jump on opposite condition
  3575.             Jmp Toofar   ;long jump to TOOFAR
  3576.            Skipjump
  3577.        
  3578.        Too many MACRO parameters: <maximum parameters>
  3579.          Too many parameters are being passed to the macro upon
  3580.          invocation.  The maximum number of parameters is not determined
  3581.          by the number specified in the macro declaration, but rather is
  3582.          based on internal memory constraints.  The number of parameters
  3583.          must be reduced.  The maximum allowed parameters are displayed.
  3584.        
  3585.        Undefined assembly directive: <number>
  3586.          Should not get this error.  It means that the instruction is an
  3587.          assembly directive that is not fully defined.
  3588.        
  3589.        Undefined error
  3590.          Should not get this error.  It means that an undefined error
  3591.          occurred.
  3592.        
  3593.        Undefined symbol: <symbol>
  3594.          The symbol was used but not defined anywhere.  Might be because
  3595.          the first digit of a hexadecimal number was not 0 through 9.
  3596.          This error can be enabled for all subsequent occurrences of
  3597.          the symbol with the FLAGALL+ directive.
  3598.        
  3599.        Unrecognized instruction: <mnemonic>
  3600.          The instruction mnemonic was not recognized.  It is not an 8086
  3601.          instruction, assembly directive, or a macro.  The mnemonic is
  3602.          displayed.
  3603.        
  3604.        Unused symbol: <symbol>
  3605.          The declared symbol was never used.  This message does not
  3606.          indicate an error, but rather assists in "cleaning up" the
  3607.          source code.  The detection of unused symbols enabled is enabled
  3608.          with the UNUSED+ directive.
  3609.        
  3610.        WASM detects checksum failure
  3611.          The copy of WASM.COM is corrupted and cannot be used.  If you
  3612.          don't know why you're getting this message, try making a new
  3613.          working copy from your master disk or the original archive file.
  3614.        
  3615.  
  3616.        78                                               Assembly Messages
  3617.        
  3618.        WASM detects incorrect DOS version
  3619.          The operating system is pre-2.0.  WASM requires PC or MS DOS 2.0
  3620.          or greater to function.
  3621.        
  3622.        WASM detects insufficient memory
  3623.          There is not enough free memory for WASM to function.  Though
  3624.          your computer may have enough memory installed, device drivers
  3625.          and memory resident programs could be using too much.  See
  3626.          Memory Limitations.
  3627.        
  3628.  
  3629.        Instruction Set                                                 79
  3630.        
  3631.                                  Instruction Set
  3632.        
  3633.        This is a brief list of all the legal predefined instructions and
  3634.        their operand types.  The instructions are divided up by function.
  3635.        The groups are: assembly directives, data transfer, arithmetic,
  3636.        logic, flag setting, control transfer, string manipulation, and
  3637.        processor control. The assembly directives are more thoroughly
  3638.        described under Assembly Directives.  The 8086 instructions are
  3639.        not thoroughly described in this documentation, you'll need
  3640.        another source for that.
  3641.        
  3642.        Instruction Format:
  3643.        
  3644.          <mnemonic> = <short description>
  3645.            <operand> [, <operand>, ...] [=<comment>]
  3646.        
  3647.        Operand Types:
  3648.        
  3649.          none     no operands
  3650.          reg      register (non-segment)
  3651.          seg      segment register
  3652.          accum    AX or AL
  3653.          mem      memory operand
  3654.          immed    immediate data
  3655.          near     near label
  3656.          string   string data
  3657.          symbol   a unique symbol
  3658.        
  3659.        Operands separated by slashes mean that either one may be used.
  3660.        Operands in capital letters are the literal operands accepted.
  3661.        Operands in brackets are optional, all others are required.
  3662.        
  3663.        Numbers in parenthesis indicate the allowable size (number of
  3664.        bits) for the specified operands.  If no size is given then the
  3665.        operands may be either 8 or 16 bit (where applicable).
  3666.        
  3667.        ******************************************************************
  3668.        
  3669.                                Assembly Directives
  3670.        
  3671.        DB = declare bytes
  3672.          immed/string [, immed/string, ...]
  3673.        
  3674.        DS = declare storage
  3675.          immed [, immed(8)] = bytes, value (default 0)
  3676.        
  3677.        DW = declare words
  3678.          immed [, immed, ...]
  3679.        
  3680.        ELSE = conditional "else"
  3681.          immed
  3682.        
  3683.        ELSEIF = conditional "else-if"
  3684.          immed
  3685.        
  3686.  
  3687.        80                                                 Instruction Set
  3688.        
  3689.        ENDIF = end of conditional statement
  3690.          none
  3691.        
  3692.        ENDM = end of macro declaration
  3693.          none
  3694.        
  3695.        ENDP = end of procedure
  3696.          none
  3697.        
  3698.        EQU = equate, requires label
  3699.          immed
  3700.        
  3701.        ERROR = programmer defined error
  3702.          string = error message
  3703.        
  3704.        EXPAND+ = list macro expansions (default)
  3705.          none
  3706.        
  3707.        EXPAND- = do not list macro expansions
  3708.          none
  3709.        
  3710.        ERRORMAX = set maximum errors (default 65535)
  3711.          immed
  3712.        
  3713.        FLAGALL+ = flag all occurrences of undefined symbols
  3714.          none
  3715.        
  3716.        FLAGALL- = flag only first occurrence of undef. symbols (default)
  3717.          none
  3718.        
  3719.        IF = conditional "if"
  3720.          immed
  3721.        
  3722.        IFN = conditional "if not"
  3723.          immed
  3724.        
  3725.        INCLUDE = include source file
  3726.          string = file name (default source drive and ext)
  3727.        
  3728.        JUMP+ = flag long jumps that could be short
  3729.          none
  3730.        
  3731.        JUMP- = do not flag long jumps that could be short (default)
  3732.          none
  3733.        
  3734.        LABEL = define label, requires label
  3735.          NEAR/FAR/BYTE/WORD/DWORD/QWORD/TBYTE/ANYSIZE
  3736.        
  3737.        LINESIZE = set page width (default 79)
  3738.          [immed] [, immed(8), ...] = page width, printer codes
  3739.        
  3740.        LIST+ = generate listing (default if list file specified)
  3741.          none
  3742.        
  3743.  
  3744.        Instruction Set                                                 81
  3745.        
  3746.        LIST- = list output off
  3747.          none
  3748.        
  3749.        MACRO = start of macro declaration
  3750.          [symbol, ...] = parameter names
  3751.        
  3752.        MACROC = start of conditional macro declaration
  3753.          [symbol, ...] = parameter names
  3754.        
  3755.        NEXTIF = conditional "if", same level
  3756.          immed
  3757.        
  3758.        ORG = origin (default 100H)
  3759.          immed = relative to location if signed
  3760.        
  3761.        PAGE = start new page
  3762.          [immed/string]  = page number, subtitle
  3763.          immed [, string] = page number, subtitle
  3764.        
  3765.        PAGE+ = start auto paging
  3766.          [immed/string]  = page number, subtitle
  3767.          immed [, string] = page number, subtitle
  3768.        
  3769.        PAGE- = stop auto paging (default)
  3770.          none
  3771.        
  3772.        PAGESIZE = set page size (default 60,79)
  3773.          immed [,immed] = page length, page width
  3774.        
  3775.        PROC = beginning of procedure
  3776.          NEAR/FAR
  3777.        
  3778.        RESETC = reset byte counter
  3779.         [immed] [,immed] = counter value, checksum value (default 0, 0)
  3780.        
  3781.        SUBTITLE = set program subtitle
  3782.          string = subtitle
  3783.        
  3784.        SYMDUMP+ = symbol table dump on
  3785.          none
  3786.        
  3787.        SYMDUMP- = symbol table dump off (default)
  3788.          none
  3789.        
  3790.        TITLE = set program title
  3791.          string [, string] = title, subtitle
  3792.        
  3793.        UNUSED+ = flag unused symbols
  3794.          none
  3795.        
  3796.        UNUSED- = do not flag unused symbols (default)
  3797.          none
  3798.        
  3799.  
  3800.        82                                                 Instruction Set
  3801.        
  3802.        ******************************************************************
  3803.        
  3804.                                   Data Transfer
  3805.        
  3806.        IN = input
  3807.          accum, immed(8) = input from a fixed port
  3808.          accum, DX = input from a variable port in DX
  3809.        
  3810.        LAHF = load AH with flags
  3811.          none
  3812.        
  3813.        LDS = load DS and register (16)
  3814.          reg, reg/mem
  3815.        
  3816.        LEA = load effective address (16)
  3817.          reg, reg/mem
  3818.        
  3819.        LES = load ES and register (16)
  3820.          reg, reg/mem
  3821.        
  3822.        MOV = move
  3823.          reg/mem, reg/seg
  3824.          reg/seg, reg/mem
  3825.          reg/mem, immed
  3826.        
  3827.        OUT = output
  3828.          immed(8), accum = output to fixed port
  3829.          DX, accum = output to variable port in DX
  3830.        
  3831.        POP = pop (16)
  3832.          reg/seg/mem
  3833.        
  3834.        POPF = pop flags
  3835.          none
  3836.        
  3837.        PUSH = push (16)
  3838.          reg/seg/mem
  3839.        
  3840.        PUSHF = pop flags
  3841.          none
  3842.        
  3843.        SAHF = store AH to flags
  3844.          none
  3845.        
  3846.        XCHG = exchange
  3847.          reg/mem, reg
  3848.          reg, reg/mem
  3849.        
  3850.        XLAT = translate byte in AL
  3851.          none
  3852.        
  3853.  
  3854.        Instruction Set                                                 83
  3855.        
  3856.        ******************************************************************
  3857.        
  3858.                                    Arithmetic
  3859.        
  3860.        AAA = ASCII adjust for add
  3861.          none
  3862.        
  3863.        AAD = ASCII adjust for divide
  3864.          none
  3865.        
  3866.        AAM = ASCII adjust for multiply
  3867.          none
  3868.        
  3869.        AAS =  ASCII adjust for subtract
  3870.          none
  3871.        
  3872.        ADC = add with carry
  3873.          reg/mem, reg
  3874.          reg, reg/mem
  3875.          reg/mem, immed
  3876.        
  3877.        ADD = add
  3878.          reg/mem, reg
  3879.          reg, reg/mem
  3880.          reg/mem, immed
  3881.        
  3882.        CBW = convert byte to word
  3883.          none
  3884.        
  3885.        CWD = convert word to double word
  3886.          none
  3887.        
  3888.        DAA = decimal adjust for add
  3889.          none
  3890.        
  3891.        DAS = decimal adjust for subtract
  3892.          none
  3893.        
  3894.        DEC = decrement
  3895.          reg/mem
  3896.        
  3897.        DIV = divide, unsigned
  3898.          [accum,] reg/mem = accum implicit
  3899.        
  3900.        IDIV = integer divide, signed
  3901.          [accum,] reg/mem = accum implicit
  3902.        
  3903.        IMUL = integer multiply, signed
  3904.          [accum,] reg/mem = accum implicit
  3905.        
  3906.        INC = increment
  3907.          reg/mem
  3908.        
  3909.  
  3910.        84                                                 Instruction Set
  3911.        
  3912.        MUL = multiply, unsigned
  3913.          [accum,] reg/mem = accum implicit
  3914.        
  3915.        NEG = decrement
  3916.          reg/mem
  3917.        
  3918.        SBB = subtract with borrow
  3919.          reg/mem, reg
  3920.          reg, reg/mem
  3921.          reg/mem, immed
  3922.        
  3923.        SUB = subtract
  3924.          reg/mem, reg
  3925.          reg, reg/mem,
  3926.          reg/mem, immed
  3927.        
  3928.        
  3929.        ******************************************************************
  3930.        
  3931.                                       Logic
  3932.        
  3933.        AND = and
  3934.          reg/mem, reg
  3935.          reg, reg/mem
  3936.          reg/mem, immed
  3937.        
  3938.        NOT = not
  3939.          reg/mem
  3940.        
  3941.        OR = or
  3942.          reg/mem, reg
  3943.          reg, reg/mem
  3944.          reg/mem, immed
  3945.        
  3946.        RCL = rotate through carry left
  3947.          reg/mem = one time
  3948.          reg/mem, CL = CL times
  3949.        
  3950.        RCR = rotate through carry right
  3951.          reg/mem = one time
  3952.          reg/mem, CL = CL times
  3953.        
  3954.        ROL = rotate left
  3955.          reg/mem = one time
  3956.          reg/mem, CL = CL times
  3957.        
  3958.        ROR = rotate right
  3959.          reg/mem = one time
  3960.          reg/mem, CL = CL times
  3961.        
  3962.        SAL = shift arithmetic left
  3963.          reg/mem = one time
  3964.          reg/mem, CL = CL times
  3965.        
  3966.  
  3967.        Instruction Set                                                 85
  3968.        
  3969.        SAR = shift arithmetic right
  3970.          reg/mem = one time
  3971.          reg/mem, CL = CL times
  3972.        
  3973.        SHL = shift logical left
  3974.          reg/mem = one time
  3975.          reg/mem, CL = CL times
  3976.        
  3977.        SHR = shift logical right
  3978.          reg/mem = one time
  3979.          reg/mem, CL = CL times
  3980.        
  3981.        XOR = xor
  3982.          reg/mem, reg
  3983.          reg, reg/mem
  3984.          reg/mem, immed
  3985.        
  3986.        ******************************************************************
  3987.        
  3988.                                   Flag Setting
  3989.        
  3990.        CLC = clear carry
  3991.          none
  3992.        
  3993.        CLD = clear direction
  3994.          none
  3995.        
  3996.        CLI = clear interrupt
  3997.          none
  3998.        
  3999.        CMC = clear complement carry
  4000.          none
  4001.        
  4002.        CMP = compare
  4003.          reg/mem, reg
  4004.          reg, reg/mem
  4005.          reg/mem, immed
  4006.        
  4007.        STC = set carry
  4008.          none
  4009.        
  4010.        STD = set direction
  4011.          none
  4012.        
  4013.        STI = set interrupt
  4014.          none
  4015.        
  4016.        TEST = test
  4017.          reg/mem, reg
  4018.          reg, reg/mem
  4019.          reg/mem, immed
  4020.        
  4021.  
  4022.        86                                                 Instruction Set
  4023.        
  4024.        ******************************************************************
  4025.        
  4026.                                 Control Transfer
  4027.        
  4028.        CALL = call
  4029.          near = direct within segment
  4030.          immed (offset), immed (segment) = direct intersegment
  4031.          reg/mem = indirect within segment (16)
  4032.          mem = indirect intersegment (32)
  4033.        
  4034.        INT = interrupt
  4035.          immed(8)
  4036.        
  4037.        INT3 = type 3 interrupt
  4038.          none
  4039.        
  4040.        INTO = interrupt on overflow
  4041.          none
  4042.        
  4043.        IRET =interrupt return
  4044.          none
  4045.        
  4046.        JA = jump if above
  4047.          near
  4048.        
  4049.        JAE = jump if above or equal
  4050.          near
  4051.        
  4052.        JB = jump if below
  4053.          near
  4054.        
  4055.        JBE = jump if below or equal
  4056.          near
  4057.        
  4058.        JC = jump if carry
  4059.          near
  4060.        
  4061.        JCXZ = jump if CX equal to zero
  4062.          near
  4063.        
  4064.        JE = jump if equal
  4065.          near
  4066.        
  4067.        JG = jump if greater
  4068.          near
  4069.        
  4070.        JGE = jump if greater or equal
  4071.          near
  4072.        
  4073.        JL = jump if less
  4074.          near
  4075.        
  4076.        JLE = jump if less or equal
  4077.          near
  4078.        
  4079.  
  4080.        Instruction Set                                                 87
  4081.        
  4082.        JMP = unconditional jump
  4083.          near = direct within segment
  4084.          immed (offset), immed (segment) = direct intersegment
  4085.          reg/mem = indirect within segment (16)
  4086.          mem = indirect intersegment (32)
  4087.        
  4088.        JMPS = unconditional short jump
  4089.          near
  4090.        
  4091.        JNA = jump if not above
  4092.          near
  4093.        
  4094.        JNAE = jump if not above or equal
  4095.          near
  4096.        
  4097.        JNB = jump if not below
  4098.          near
  4099.        
  4100.        JNBE = jump if not below or equal
  4101.          near
  4102.        
  4103.        JNC = jump if no carry
  4104.          near
  4105.        
  4106.        JNE = jump if not equal
  4107.          near
  4108.        
  4109.        JNG = jump if not greater
  4110.          near
  4111.        
  4112.        JNGE = jump if not greater or equal
  4113.          near
  4114.        
  4115.        JNL = jump if not less
  4116.          near
  4117.        
  4118.        JNLE = jump if not less or equal
  4119.          near
  4120.        
  4121.        JNO = jump if not overflow
  4122.          near
  4123.        
  4124.        JNP = jump if not parity
  4125.          near
  4126.        
  4127.        JNS = jump if not sign
  4128.          near
  4129.        
  4130.        JNZ = jump if not zero
  4131.          near
  4132.        
  4133.        JO = jump if overflow
  4134.          near
  4135.        
  4136.  
  4137.        88                                                 Instruction Set
  4138.        
  4139.        JP = jump if parity
  4140.          near
  4141.        
  4142.        JPE = jump if parity even
  4143.          near
  4144.        
  4145.        JPO = jump if parity odd
  4146.          near
  4147.        
  4148.        JS = jump if sign
  4149.          near
  4150.        
  4151.        JZ = jump if zero
  4152.          near
  4153.        
  4154.        LOOP = loop CX times
  4155.          near
  4156.        
  4157.        LOOPE = loop while equal
  4158.          near
  4159.        
  4160.        LOOPNE = loop while not equal
  4161.          near
  4162.        
  4163.        LOOPNZ = loop while not zero
  4164.          near
  4165.        
  4166.        LOOPZ = loop while zero
  4167.          near
  4168.        
  4169.        RET = return, type determined by procedure
  4170.          none
  4171.          immed = add immed to stack
  4172.        
  4173.        RETF = within segment return
  4174.          none
  4175.          immed = add immed to stack
  4176.        
  4177.        RETN = intersegment return
  4178.          none
  4179.          immed = add immed to stack
  4180.        
  4181.        ******************************************************************
  4182.        
  4183.                                String Manipulation
  4184.        
  4185.        CMPSB = compare string byte
  4186.          none
  4187.        
  4188.        CMPSW = compare string word
  4189.          none
  4190.        
  4191.        LODSB = load string byte
  4192.          none
  4193.        
  4194.  
  4195.        Instruction Set                                                 89
  4196.        
  4197.        LODSW = load string word
  4198.          none
  4199.        
  4200.        MOVSB = move string byte
  4201.          none
  4202.        
  4203.        MOVSW = move string word
  4204.          none
  4205.        
  4206.        REP = repeat CX times
  4207.          none
  4208.        
  4209.        REPE = repeat while equal
  4210.          none
  4211.        
  4212.        REPNE = repeat while not equal
  4213.          none
  4214.        
  4215.        REPNZ = repeat while not zero
  4216.          none
  4217.        
  4218.        REPZ = repeat while zero
  4219.          none
  4220.        
  4221.        SCASB = scan string byte
  4222.          none
  4223.        
  4224.        SCASW = scan string word
  4225.          none
  4226.        
  4227.        STOSB = store string byte
  4228.          none
  4229.        
  4230.        STOSW = store string word
  4231.          none
  4232.        
  4233.        ******************************************************************
  4234.        
  4235.                                 Processor Control
  4236.        
  4237.        HLT = halt
  4238.          none
  4239.        
  4240.        LOCK = bus lock prefix
  4241.          none
  4242.        
  4243.        NOP = no operation
  4244.          none
  4245.        
  4246.        SEG = segment override prefix
  4247.          seg
  4248.        
  4249.  
  4250.        90                                                 Instruction Set
  4251.        
  4252.        WAIT = wait
  4253.          none
  4254.        
  4255.        ******************************************************************
  4256.        
  4257.  
  4258.        External Subroutines                                            91
  4259.        
  4260.                               External Subroutines
  4261.        
  4262.        Programs assembled by WASM may be used as external subroutines by
  4263.        other programs.  A programming language that can call pure binary
  4264.        image, external, machine language subroutines should be able to
  4265.        call programs assembled with WASM.  BASIC and Turbo Pascal are two
  4266.        languages that can do this.  Refer to the BASIC or Pascal manual
  4267.        for the specific implementation.
  4268.        
  4269.        BASIC expects the external machine language subroutine to be in
  4270.        the BLOAD format.  This is easily done adding the proper header to
  4271.        the file, which is as follows:
  4272.        
  4273.          ;this is a BLOAD header, it should
  4274.          ;be the first code in the program
  4275.           Db 0fdh    ;BLOAD marker
  4276.           Dw 0f000H  ;segment to load it at
  4277.           Dw 0       ;offset to load it at
  4278.           Dw $Size   ;size of program
  4279.        
  4280.        The segment and offset of the load can be any number, since it
  4281.        should be specified by the programmer when loading it from BASIC.
  4282.        Making load address F000:0000 (which is read only memory) will
  4283.        prevent loading it over something important if the address is not
  4284.        specified.
  4285.        
  4286.        Turbo Pascal external subroutines do not require any special
  4287.        format.
  4288.        
  4289.        The code within Pascal subroutines must be relocatable.  This
  4290.        means that no references to the location counter should be made
  4291.        (the location is undefined).  Since memory labels cannot be used,
  4292.        there is no good way to access declared local data; its probably
  4293.        better to just do without such data.  BASIC subroutines may or may
  4294.        not have to be relocatable, depending upon where they are stored.
  4295.        If the address is known beforehand (in an unused screen buffer for
  4296.        instance), the code need not be relocatable and the starting
  4297.        offset will be known and can be set with ORG.  If the BASIC
  4298.        subroutine is stored in a variable's data space or a file buffer,
  4299.        then the code must be relocatable.
  4300.        
  4301.        Machine language subroutines may be debugged by placing an INT3
  4302.        instruction within the code and then running the entire program
  4303.        (BASIC or Pascal) under DEBUG.  When the subroutine is executed,
  4304.        the INT3 will give control to the DEBUG program and allow you to
  4305.        step through your code.  Make sure to remove the INT3 and
  4306.        reassemble the code when you are through debugging.
  4307.        
  4308.        Programs that are assembled as subroutines are not directly
  4309.        executable, thus it may be a wise idea to name them with an
  4310.        extension other than .COM (which implies that a program is
  4311.        executable).
  4312.        
  4313.  
  4314.        92                                       Source Code Clarification
  4315.        
  4316.                             Source Code Clarification
  4317.        
  4318.        Many of the conventions used by WASM are also used by other
  4319.        assemblers and debuggers.  This section compares WASM to other
  4320.        assemblers and the DEBUG program provided with DOS.  This section
  4321.        also points out a few particulars of WASM syntax.
  4322.        
  4323.        Some assemblers add a suffix to the mnemonic to indicate the size
  4324.        of the operation, whether immediate data is involved, and the type
  4325.        of calls, jumps, and returns that are being used.  WASM identifies
  4326.        the type and size of the instruction mainly on the basis of the
  4327.        operands, in accordance with the DOS DEBUG program.
  4328.        
  4329.        WASM allows the programmer to define the size of the operand
  4330.        through the use of a functional operand (BYTE, WORD, etc.).  This
  4331.        is very similar to the structure used by the DEBUG program and the
  4332.        IBM Macro Assembler.
  4333.        
  4334.          ;the following statement in WASM...
  4335.           Mov WOrD [5+sI+  10 +Bp+5], not 1111111111111111B
  4336.        
  4337.          ; ...is disassembled as the following in DEBUG
  4338.          ; MOV     W,[BP+SI+14],0000          ;DOS 1.1 DEBUG
  4339.          ; MOV     WORD PTR [BP+SI+14],0000   ;DOS 2.0 DEBUG
  4340.        
  4341.        Near and far indirect branching may be implemented by specifying
  4342.        the size of the operand or actually using the NEAR and FAR
  4343.        functions.  Debug uses FAR for far branching and nothing for near
  4344.        branching.
  4345.        
  4346.           Call Near [Bx]  ;
  4347.           Call Word [Bx]  ;these two are the same thing to WASM
  4348.          ;Call [Bx]       ;debug format
  4349.        
  4350.           Call Far [Bx]    ;
  4351.           Call Dword [Bx]  ;these two are the same thing to WASM
  4352.          ;Call Far [Bx]    ;debug format
  4353.        
  4354.        The size of the string manipulation instructions are specified by
  4355.        a B or W suffix added to the mnemonic.  This is the same as the
  4356.        DEBUG program.
  4357.        
  4358.           Movsb  ;move string byte
  4359.           Movsw  ;move string word
  4360.        
  4361.        JMPS is the mnemonic that WASM uses to specify a short
  4362.        unconditional jump to a near label.  JMP always means a long jump.
  4363.        The (DOS 2.0) DEBUG program uses JMP for both long and short
  4364.        jumps.
  4365.        
  4366.           Jmps Location1    ;short unconditional jump
  4367.           Jmp Location1     ;long unconditional jump
  4368.        
  4369.  
  4370.        Source Code Clarification                                       93
  4371.        
  4372.        WASM sets the type of return for a RET based on the procedure
  4373.        type.  A near (within segment) or far (intersegment) return may be
  4374.        encoded without using a PROC through the use of RETN and RETF
  4375.        respectively.  The DEBUG program uses RET to indicate a near
  4376.        return and a RETF to indicate a far return.
  4377.        
  4378.           Proc  Far               ;<---
  4379.           Ret         ;far return     ; far routine
  4380.           Retn        ;near return    ;
  4381.           Retf        ;far return     ;
  4382.                                       ;
  4383.           Proc  Near                  ; <---
  4384.           Ret         ;near return    ;    ; near routine
  4385.           Retn        ;near return    ;    ;
  4386.           Retf        ;far return     ;    ;
  4387.           Endp                        ; <---
  4388.                                       ;
  4389.           Ret         ;far return     ;
  4390.           Endp                    ;<---
  4391.        
  4392.        The bit shifting instructions (SHL, SHR, ROL, etc.) are
  4393.        interpreted to be a single shift by WASM if there is only one
  4394.        operand (the operand to be shifted).  Shifts using the CL register
  4395.        as a counter are implemented by specifying CL as the second
  4396.        operand.  The DEBUG program requires a "1" as a second operand to
  4397.        specify a single shift.
  4398.        
  4399.            Rol Ax      ;roll AX left by one
  4400.          ; Rol Ax,1    ;roll AX left by one, DEBUG format
  4401.            Shr Byte [Bx],Cl   ;shift 8 bits at [BX] CL times
  4402.        
  4403.        Some assemblers leave out an operand if the operand is implicit in
  4404.        the instruction.  AX is implicit in the following instructions:
  4405.        IN, OUT, MUL, IMUL, DIV, and IDIV.  WASM requires the AX (or AL)
  4406.        register in the IN and OUT instructions but allows the others with
  4407.        or without it.  The DEBUG program leaves out the AX or AL register
  4408.        on multiply or divide instructions, but does not on the others.
  4409.        
  4410.           In    Ax,Dx   ;AX receives input word from port in DX
  4411.        
  4412.          ;both of the following are: AX = DX.AX x CX
  4413.           Mul   Ax,Cx   ;WASM allows this
  4414.           Mul   Cx      ;WASM and DEBUG allow this
  4415.        
  4416.        WASM and DEBUG implement instruction prefixes as a separate
  4417.        instruction, i.e. they appear on the line above the instruction to
  4418.        modify.  The prefixes are: LOCK, REP, REPE, REPNE, REPNZ, REPZ,
  4419.        and SEG.
  4420.        
  4421.           Rep
  4422.           Stosb       ;store byte CX times
  4423.        
  4424.           Seg Ss
  4425.           Mov Ax,[Bx] ;[Bx] is in the stack segment
  4426.        
  4427.  
  4428.        94                                       Source Code Clarification
  4429.        
  4430.        WASM and DEBUG both specify indirect memory operands by putting
  4431.        all values and registers inside the brackets.
  4432.        
  4433.          ;this in WASM ...
  4434.            Sub [Bx+10],Ax
  4435.            Sub [BX+Data],Ax
  4436.          ;... may be implemented by others like one of these
  4437.          ; Sub [Bx]+10,Ax
  4438.          ; Sub 10[Bx],Ax
  4439.          ; Sub Data[Bx],Ax
  4440.        
  4441.          Data Label Word
  4442.        
  4443.        The mnemonic for an optimized type 3 interrupt is INT3.
  4444.        
  4445.          ;both of statements these cause type 3 interrupts,
  4446.          ;but the first uses only one byte of code
  4447.           Int3
  4448.           Int 3
  4449.        
  4450.        WASM assumes the entire program and all data are in the same
  4451.        segment, so there are no segment definitions.  The location
  4452.        counter is automatically started at 100H, in accordance with COM
  4453.        file format.  Though WASM doesn't allow segment definitions, a
  4454.        program may, of course, set up and maintain its own segments
  4455.        during execution.
  4456.        
  4457.        The implementation and usage of assembly directives vary widely
  4458.        among assemblers.  The general format of procedure, macro, and
  4459.        data declarations are similar, but mostly incompatible among
  4460.        assemblers.  WASM uses a fairly simplified set of directives, most
  4461.        of which are comparable, though not compatible, to other
  4462.        assemblers.
  4463.        
  4464.        Several 8086 instructions mean the same thing as other
  4465.        instructions and produce identical object code.  The DEBUG program
  4466.        always disassembles these instructions using one particular
  4467.        mnemonic.  One example is JNLE (jump not less or equal) and JG
  4468.        (jump greater).  The DEBUG program disassembles both of these
  4469.        instructions as JG.
  4470.        
  4471.        Symbols that are declared within skipped source code should be
  4472.        undefined.  These symbols, though, are placed in the symbol table
  4473.        anyway and still subject to duplicate definition and other symbol
  4474.        declaration errors.  This will hopefully be corrected in future
  4475.        versions of WASM.
  4476.        
  4477.  
  4478.        Source Code Clarification                                       95
  4479.        
  4480.          ;in theory the second two symbols don't really
  4481.          ;exist, since they are in source code that is
  4482.          ;skipped because of the false IF directive; in
  4483.          ;spite of "not existing," the second declaration
  4484.          ;of SYMBOL2 causes a duplicate definition
  4485.        
  4486.          Symbol2
  4487.           If 0
  4488.          Symbol1  ;considered undefined
  4489.          Symbol2  ;duplicate definition
  4490.           Endif
  4491.        
  4492.        There is an uncaught error for certain registers as operands.
  4493.        When the operand DX is used in IN's and OUT's, and CL is used for
  4494.        shifts and rolls, WASM only looks for a register type, not those
  4495.        particular registers.  This means that in those cases any register
  4496.        will work in place of a DX or CL (except a segment register).
  4497.        Also WASM does not search for extra operands, they do not cause
  4498.        errors if they exist.
  4499.        
  4500.          ;some uncaught errors
  4501.           In  Ax,Bx
  4502.           Shl Ax,Bx
  4503.           Mov Ax,Bx,Cx,Dx
  4504.        
  4505.  
  4506.        96                                              Memory Limitations
  4507.        
  4508.                                Memory Limitations
  4509.        
  4510.        WASM requires a about 100 kilobytes (K) of free RAM for execution.
  4511.        The only aspect of WASM that varies with the amount of available
  4512.        memory is the macro storage capacity.  With a minimum amount of
  4513.        memory (100K), less than a 1000 bytes of macro storage is
  4514.        available.  Every free byte after that, up to 64K, is used for
  4515.        macro storage.  With 164K bytes available, the maximum usable
  4516.        amount of memory, about 1600 lines at 40 characters apiece can be
  4517.        stored.  The length of the macro lines is significant, i.e. the
  4518.        shorter the lines, the more lines that can be stored.
  4519.        
  4520.        The symbol table has room for about 2000 symbols at 10 bytes
  4521.        apiece.  Like macro lines, the shorter the symbols, the more
  4522.        symbols that can be stored.  An internal code table (which saves a
  4523.        partial tokenized assembly of the program) has room for 10800
  4524.        entries.  Every source line creates an entry in the code table,
  4525.        except blank lines and lines resulting from a macro expansion.
  4526.        Lines that are skipped due to conditional assembly and the
  4527.        conditional directives themselves DO take up room in the code
  4528.        table, even though they do not show up in the assembly.  The
  4529.        symbol table size and code table size do not change, even if the
  4530.        memory is available.
  4531.        
  4532.  
  4533.        Bibliography                                                    97
  4534.        
  4535.                                   Bibliography
  4536.        
  4537.        These books were used as references in the development of WASM
  4538.        and the writing of this documentation.  In addition to this list,
  4539.        there are many other excellent sources of information on the 8086
  4540.        microprocessor and assembly language programming.
  4541.        
  4542.        "BASIC Version 1.10." 2st ed. Boca Raton, FL: International
  4543.          Business Machines Corp., 1981 and 1982.
  4544.        
  4545.        Duncan, Ray. "Advanced MS DOS." Redmond, WA: Microsoft Press,
  4546.          1986.
  4547.        
  4548.        "iAPX 86/88, 186/188 User's Manual." Santa Clara, CA: Intel
  4549.          Corp., 1985.
  4550.        
  4551.        King, Richard A. "The IBM PC-DOS Handbook." Berkeley, CA: SYBEX
  4552.          Inc., 1983.
  4553.        
  4554.        Morgan, Christopher L., and Mitchell Waite. "8086/8088 16-Bit
  4555.          Microprocessor Primer."  Peterborough, NH: BYTE/McGraw-Hill,
  4556.          1982.
  4557.        
  4558.        "Technical Reference." Rev. ed. Boca Raton, FL: International
  4559.          Business Machines Corp., 1981, 1982, 1983, and 1984.
  4560.        
  4561.        "Turbo Pascal Reference Manual Version 3.0." Scotts Valley, CA:
  4562.          Borland International Inc., 1983, 1984, and 1985.
  4563.        
  4564.  
  4565.        98                                                           Index
  4566.        
  4567.                                       Index
  4568.        
  4569.        '                           11      DEBUG program               92
  4570.        ()                          14      Declaring data,             35
  4571.        ,                            6        byte                      35
  4572.        ;                            7        examples                  35
  4573.        ?                           11        location                  35
  4574.        []                          11        storage                   35
  4575.        $                           61        string                    35
  4576.        $CHKSUM constant            61        word                      35
  4577.        $COUNT constant             61      Default file name            4
  4578.        $DATE1 constant             62      Delimiter                    6
  4579.        $DATE2 constant             62      Directive,               6, 37
  4580.        $LOC constant               62        compatibility             94
  4581.        $SIZE constant              62        conditional               19
  4582.        $SUM constant               62        list of                   79
  4583.        $TIME1 constant             63        syntax                     9
  4584.        $TIME2 constant             63      Distribution policy          3
  4585.        $VERSION constant           63      Dollar sign                 61
  4586.        Addressing,                         DS directive            35, 38
  4587.          direct                    11      DW directive            35, 38
  4588.          indirect                  11      DWORD function          56, 92
  4589.          registers                 11      EDLIN program                6
  4590.        ANYSIZE function            55      ELSE directive  20, 21, 22, 38
  4591.        ASM filename extension       4      ELSEIF directive    20, 21, 22
  4592.        Assembling programs          4                                  39
  4593.        BASIC subroutines           91      End of file                  6
  4594.        Basic syntax                 6      ENDIF directive     21, 22, 39
  4595.        Blank line                   7      ENDM directive          28, 40
  4596.        Bload,                              ENDP directive          17, 40
  4597.          address                   91      EQU directive               40
  4598.          format                    91      Equates                      8
  4599.        Brackets                    11      Error,                   5, 68
  4600.        Bug, in WASM            94, 95        AND                       14
  4601.        BYTE function           55, 92        count                     68
  4602.        CALL instruction            17        critical                  68
  4603.        COM filename extension       4        description of messages   68
  4604.        Comma                        6        flagging                  68
  4605.        Comment,                              message                   68
  4606.          description of messages   68        MOD                       14
  4607.          message                   68        multiple                  68
  4608.          source                     7        OR                        14
  4609.        Compatibility of source               XOR                       14
  4610.         code                       92      Error code,
  4611.        CON device                   4       upon termination            5
  4612.        Conditional assembly,       18      ERROR directive         41, 68
  4613.          directives                19      ERRORLEVEL batch command     5
  4614.          expansion of macros       30      ERRORMAX directive      42, 68
  4615.          in macros                 28      EXPAND+ directive   34, 42, 65
  4616.          nested                    22      EXPAND- directive   34, 42, 65
  4617.        Constant                    61      Expression,                 14
  4618.        Control characters           6        examples                  14
  4619.        Data declaration            35        operators                 14
  4620.        DB directive            35, 37        signed                    14
  4621.        
  4622.  
  4623.        Index                                                           99
  4624.        
  4625.        FAR function            56, 92      Macro (cont.),
  4626.        Field,                       6        invocation                30
  4627.          interpretation             6        listing                   34
  4628.        File name, default           4        local symbols             28
  4629.        FLAGALL+ directive      43, 68        memory limitation         96
  4630.        FLAGALL- directive      43, 68        nest level                34
  4631.        IF directive    19, 21, 22, 43        nested                    32
  4632.        IFN directive           19, 43        nul parameter         28, 30
  4633.        Immediate data,             10        parameter                 28
  4634.          characters                10        parameter passing         30
  4635.          in expressions            14        parameter substitution    30
  4636.          size                      11        parameter testing         28
  4637.        INCLUDE directive           44        parameter validity        28
  4638.        Instruction,          6, 9, 37        recursive                 32
  4639.          bit shifting              93        recursive parameter       32
  4640.          disassembly               94        source lines              28
  4641.          list of                   79        symbol declaration        28
  4642.          prefix and override       93      MACRO directive         28, 47
  4643.          string                    92      MACROC directive        33, 47
  4644.          syntax                     6      Memory,
  4645.        Interrupt, type 3           91        code table                96
  4646.        JMP instruction             92        label                      8
  4647.        JUMP+ directive         44, 68        limitation                96
  4648.        JUMP- directive         44, 68        minimum                   96
  4649.        Label,                       8        segments                  94
  4650.          in expressions            14        symbol table              96
  4651.          memory                 8, 35      Memory operand,             11
  4652.          near                       8        addressing registers      11
  4653.        LABEL directive         35, 45        direct addressing         11
  4654.        Line,                                 indirect addressing       11
  4655.          blank                      7        size                      12
  4656.          syntax                     6      Message,
  4657.        LINESIZE directive          46        descriptions              68
  4658.        List,                    4, 65        during assembly           68
  4659.          columnar headings         66      NEAR function           56, 92
  4660.          header                    65      NEG function                57
  4661.          line                      66      NEXTIF directive    19, 21, 22
  4662.          page number               65                                  48
  4663.          paging                    65      NOT function                57
  4664.          subtitle                  65      Number,                     10
  4665.          symbol table              67        binary                    10
  4666.          title                     65        decimal                   10
  4667.        List file                    4        hexadecimal               10
  4668.        LIST+ directive         46, 65        signed                    10
  4669.        LIST- directive     46, 65, 65        size                      11
  4670.        LST filename extension       4      Object file                  4
  4671.        Macro,                   8, 27      OFFSET function             58
  4672.          conditional               33      Operand,                 6, 10
  4673.          conditional assembly      28        compatibility             25
  4674.          declaration               28        conditional testing       25
  4675.          errors in                 34        constants                 61
  4676.          expansion                 30        examples                  12
  4677.          field interpretation      28        expressions               14
  4678.          global symbols            28        false                     24
  4679.        
  4680.  
  4681.        100                                                          Index
  4682.        
  4683.        Operand (cont.),                    Source file (cont.),
  4684.          functional                55        external                  44
  4685.          implicit                  93        type                       6
  4686.          required                  10      Spaces                       6
  4687.          size                      11      Statistics, assembly         5
  4688.          syntax                     6      String,                     11
  4689.          true                      24        declaration               35
  4690.          type                  10, 25      Structured programing       16
  4691.        Operator,                   14      Subroutine,                 91
  4692.          conditional               24        BASIC                     91
  4693.        ORG directive               49        debugging                 91
  4694.        Origin,                     49        location counter          91
  4695.          default                   94        naming                    91
  4696.        PAGE directive          49, 65        Pascal                    91
  4697.        Page number                 65        relocation                91
  4698.        PAGE+ directive         50, 65      SUBTITLE directive      52, 65
  4699.        PAGE- directive         50, 65      Symbol,                   6, 8
  4700.        PAGESIZE directive      50, 65        as instructions            8
  4701.        Parameter,                            as operands                8
  4702.          command line               4        declaration                8
  4703.          command line examples      5        declaration syntax         6
  4704.          macro                 27, 28        label                      8
  4705.          procedural                17        location of declaration    8
  4706.        Parenthesis,                14        required declaration       6
  4707.          signed                    14        reserved                  64
  4708.        Pascal subroutines          91        table                      8
  4709.        Printer                      4        type                       8
  4710.        PRN device                   4        type determination         8
  4711.        PROC directive          17, 51        undefined                 94
  4712.        Procedure,                  17        uniqueness         8, 64, 94
  4713.          declaration               17      Symbol table,                8
  4714.          far                       17        list                      67
  4715.          local data                17        memory limitation         96
  4716.          near                      17      SYMDUMP+ directive  52, 65, 67
  4717.          nested                    17      SYMDUMP- directive          52
  4718.        Program structure           16      System requirements          1
  4719.        Question mark               11      TBYTE function              59
  4720.        Quotation mark              11      Termination of assembly     68
  4721.        QWORD function              58      TITLE directive         53, 65
  4722.        Register,                   10      TYPE function           25, 59
  4723.          16 bit                    11      UNUSED+ directive       53, 68
  4724.          8 bit                     10      UNUSED- directive       53, 68
  4725.          segment                   11      VALUE function          25, 59
  4726.          size                      12      WORD function           59, 92
  4727.        Registration                 3
  4728.        RESETC directive            51
  4729.        RET instruction         17, 93
  4730.        Semi-colon                   7
  4731.        SIZE function           25, 58
  4732.        Source code,
  4733.          clarification             92
  4734.          compatibility             92
  4735.          external                  44
  4736.        Source file,                 4
  4737.        
  4738.